Ad URL parameters for cost per lead per campaign
Set the URL parameters in Ads Manager so Pixel Relay can count each campaign's, ad set's and ad's leads.
Pixel Relay can split leads by the campaign, ad set and ad that brought the visitor, so the Ads tab shows cost per lead for each. It needs two things: the ads must carry their IDs in the landing page address, and the website must have Attribute leads to campaigns and ads turned on.
Set the parameters in Ads Manager
- In Ads Manager, select the ads (you can select them all and edit them together).
- In the ad's Destination or Tracking section, find URL parameters.
- Paste this exactly:
utm_source=facebook&utm_medium=paid&utm_campaign={{campaign.id}}&utm_term={{adset.id}}&utm_content={{ad.id}}
- Publish. Meta replaces
{{campaign.id}},{{adset.id}}and{{ad.id}}with the real numbers when someone clicks.
| Parameter | Carries |
|---|---|
utm_campaign |
The campaign ID |
utm_term |
The ad set ID |
utm_content |
The ad ID |
utm_source |
facebook (or instagram, fb, ig, meta, messenger). Another source is ignored. |
Already using UTM names?
If your web analytics relies on utm_campaign holding the campaign's name, switching to IDs changes those reports. Pixel Relay only reads numeric IDs, so names are simply ignored there.
Turn on attribution
On the website's page, under Ad performance, tick Attribute leads to campaigns and ads and click Save ad settings. The tracker picks it up within an hour, as soon as its cached copy expires.
What happens on the website
- A visitor clicks an ad and lands on a page with the parameters.
- The tracker reads the three IDs from the address. Anything that is not a number of Meta's ID length is ignored.
- It keeps them for 7 days in a first-party cookie,
_pr_ad, so later pages, and the form the visitor sends, carry them too. A click on another ad replaces them. - The relay stores the IDs with each event and uses them for the per-campaign table. It does not send them to Meta: Meta already knows which ad was clicked.
Seven days matches Meta's default 7-day click attribution, so the two are comparable.
The cookie holds nothing but the three numbers. If your site asks for consent before marketing cookies, treat _pr_ad like Meta's own _fbp and _fbc.
Forms sent from the server
Some forms are sent to the relay by the website's server rather than the visitor's browser, for example Gravity Forms with the WordPress plugin's Server key set (see Gravity Forms). These carry the visitor's _pr_ad cookie too, from WordPress plugin 1.1.1. On 1.1.0, server-sent form leads land on the Unattributed row: update the plugin from the Addons page.
Your own server-side integration can do the same: read the _pr_ad cookie (campaign.adset.ad) and send it as attribution with the event. See The track endpoint.
Check it works
- Click one of your ads, or open any page of the site with
?utm_source=facebook&utm_campaign=and a real campaign ID added to the address. - Open the browser's developer tools (F12), then Application (Chrome, Edge) or Storage (Firefox), then Cookies, and pick the site.
- A
_pr_adcookie holding the IDs, separated by dots, means the tracker picked them up. No cookie usually means attribution is off for the website, its cached tracker has not refreshed yet (up to an hour), or the IDs were not numbers.
Leads sent after that point appear under their campaign in the table on the Ads tab.
Unattributed leads
The Ads tab shows leads without IDs on an Unattributed row. They came from ads without the parameters, before attribution was turned on, more than 7 days after the click, from another browser or device, or from a visitor who blocked cookies.
Related articles
Still stuck?
Tell us what you are trying to do and we will help you set it up.