Set up cost per lead, start to finish
The checklist for cost per lead per campaign, from the Meta app and token to the ad account connection, URL parameters and form tracking.
Cost per lead needs three things to line up: what you spent (from the ad account), which leads the website received (from the relay) and, for a split by campaign, which ad each lead came from. This page is the checklist for all three. Each step links to the article with the detail.
Allow about 30 minutes. Most of it is in Meta's Business Settings.
Who does what
| Step | Usually done by | Needs |
|---|---|---|
| 1. Meta app and system user | Whoever is an admin of the Meta business | Admin access to the business that owns the ad account |
| 2. Ads token | The same person | The system user from step 1 |
| 3. Connect the ad account | Your Pixel Relay account team, or you with Manage ad account and spend | The ad account ID and the token |
| 4. URL parameters on the ads | Whoever runs the ads | Ads Manager access |
| 5. Attribution on, forms tracked | Your Pixel Relay account team, or you | The website's settings, and the WordPress plugin if you use it |
| 6. Check it works | Anyone who can see the website's analytics | A day of traffic |
If an agency runs your ads from its own business, the agency usually does steps 1, 2 and 4. See Agencies and partner access.
The checklist
- 1. A Meta app and a system user. In Business Settings, check Accounts, then Apps, for an app owned by the business. If there is none, create one at developers.facebook.com with the Business type and connect it to the business. Then add a system user under Users, then System users. Step by step.
- 2. A token with ads_read. Assign the ad account to the system user with View performance, then generate a token with ads_read and the expiry set to Never. Copy it: Meta shows it once.
- 3. Connect the ad account. On the website's page, under Ad performance, enter the Ad account ID, paste the token into Ads access token, click Save ad settings and then Check connection. When Meta answers with the account's name, currency and timezone, click Sync last 30 days. Details.
- 4. URL parameters on every ad. In Ads Manager, add the Pixel Relay URL parameters to all active ads, so each click carries its campaign, ad set and ad ID. Details.
- 5. Attribution on, and every lead form tracked. Tick Attribute leads to campaigns and ads and save. If the site runs WordPress with Gravity Forms, install plugin 1.1.1 or later and paste the website's Server key into it, so forms that send visitors to a thank-you page are counted. Forms sent from the server.
- 6. Check it works. The next day, open the website's Analytics, then Ads. Spend, Website leads and Cost per lead should all have numbers, and the table by campaign should start to fill. What to look for.
Only want account-wide cost per lead?
Steps 1 to 3 are enough for spend, cost per lead, CPM and CTR for the whole account. Steps 4 and 5 add the split by campaign, ad set and ad.
Check it works
Right after connecting. Check connection shows the account's name, currency and timezone. Under Ad performance, the status changes from Not synced yet to Last synced a few seconds after Sync last 30 days.
After a day of traffic.
- Spend on the Ads tab matches Amount spent in Ads Manager for the same days, give or take Meta's revisions to the last two days.
- Website leads match the form entries your site received from people who filled in a form themselves. Internal forms, such as a page your team uses to enter phone enquiries, should be left out of the relay: see Leaving forms out.
- The table by campaign shows your campaigns, with most leads attributed. A large Unattributed row in the first week is normal: it holds leads from clicks made before the URL parameters were added.
To test attribution yourself, open the website through one of your ads (or add ?utm_source=facebook&utm_campaign= followed by a real campaign ID to any page address). In the browser's developer tools, under Application, then Cookies, the site now has a _pr_ad cookie holding the IDs. Visits with the cookie are attributed.
Common snags
- Meta refused the request. Almost always the token: it lacks ads_read, or the system user is not assigned to this ad account. See Ad spend sync problems.
- Cost per lead looks too low or too high. Check which forms send Lead. Every event mapped to Lead counts, including internal forms if they are not left out. See event mappings.
- Website leads and Ads Manager disagree. That is expected: Meta only counts leads it can tie to an ad and revises recent days. See Why it differs from Ads Manager.
Related articles
Still stuck?
Tell us what you are trying to do and we will help you set it up.