Connect a Meta ad account
Sync daily ad spend from Meta so a website's analytics show cost per lead, or enter spend by hand.
Connect the Meta ad account that sends people to a website, and Pixel Relay syncs its spend every hour. The website's analytics then show what each lead cost. Pixel Relay only reads from the ad account: it cannot change ads, budgets or audiences.
What you need
- The ad account ID. In Ads Manager, it is the number next to the account name in the account menu, like
act_1234567890. - An access token with the
ads_readpermission for that ad account. The Conversions API token usually does not have it.
Setting everything up for the first time? Set up cost per lead, start to finish is the checklist.
Create an ads token
A system user is a Meta account for software rather than a person, so the token keeps working when staff come and go. You need to be an admin of the Meta business that owns the ad account.
First, make sure the business has an app. Meta only issues system user tokens through an app the business owns. In Business Settings, open Accounts, then Apps. If the list is empty:
- Go to developers.facebook.com/apps and click Create app.
- Choose the Business type (or Other, then Business), give it a name such as "Pixel Relay reporting" and pick your business.
- You do not need to publish it or submit it for review: a token for your own ad account works while the app is in development.
Then create the system user and its token:
- In Business Settings, open Users, then System users, and click Add. Name it (for example "Pixel Relay") and give it the Employee role.
- Click Assign assets, choose Ad accounts, pick the ad account and turn on View performance. Nothing more is needed: Pixel Relay never changes ads.
- Still under Assign assets, choose Apps, pick the app and turn on Develop app (some businesses need this before the app appears in the next step).
- Click Generate new token, choose the app, set Token expiration to Never and tick ads_read. Leave every other permission off.
- Copy the token. Meta shows it once.
Use a system user, not your own login
A token from Graph API Explorer or your personal account expires within hours or days, and stops working altogether if you leave the business. The sync then fails until someone pastes a new one.
Agencies and partner access
When an agency runs the ads from its own business, the ad account usually belongs to the client's business and is shared with the agency as a partner. Either side can create the token:
- In the client's business (simplest): follow the steps above there. The token only sees that client's ad account.
- In the agency's business: the client shares the ad account with the agency under Partners, with at least View performance. The agency then assigns that shared ad account to one of its own system users and generates the token there.
Either way, the token must belong to a system user that is assigned to the exact ad account entered in Pixel Relay.
Reusing the Conversions API token
If the Conversions API token belongs to a system user that is also assigned to the ad account with ads_read, tick Reuse the Conversions API access token instead of pasting a second one.
Connect it
- Open the website from Websites.
- In Ad performance, enter the Ad account ID and paste the token into Ads access token.
- Click Save ad settings, then Check connection. Meta's answer shows the account's name, currency and timezone.
- Click Sync last 30 days to fill in the last month straight away. After that, spend syncs every hour on its own.
The token is stored encrypted and never shown again: the field stays empty after saving. Paste a new one to replace it. Disconnect deletes the token and stops the sync.
Spend is synced per ad and per day, by the ad account's own timezone, the way Ads Manager reports it. Today's and yesterday's numbers are refreshed every hour because Meta keeps revising them.
When the sync fails
The website page and the Ads tab show Meta's error, and staff are alerted after three failures in a row. The usual cause is a token that was revoked or lost access to the ad account: create a new one and paste it in. Ad spend sync problems lists Meta's common errors and what each one means.
Enter spend by hand
Without a connection, Ad spend by hand lets you add each day's spend instead, and it feeds the same cost per lead:
- Pick the Day, enter the Spend and click Save day. Saving a day again replaces its amount.
- Or Upload a CSV and click Import. Use two columns, the date as
YYYY-MM-DDand the amount, or an Ads Manager export broken down by Day with the Amount spent column. Rows for the same day are added up. - Set Currency to the ad account's currency so amounts are shown correctly.
Hand-entered spend is ignored while an ad account is connected, so nothing is counted twice.
Keep the ad click for later pages
Tick Keep Meta's ad click for later pages when the site does not run Meta's browser pixel. Meta matches a lead to an ad mostly by the click ID (fbclid) in the ad's link, which only the landing page sees. With this on, the tracker keeps it in Meta's own _fbc cookie, with a browser ID in _fbp, for 90 days, so the lead sent from a form or a thank-you page carries it too. The cookies are first-party, set on the website's own domain, and hold no personal details. If your site asks for consent before marketing cookies, treat them like any Meta cookie.
Attribute leads to campaigns
Tick Attribute leads to campaigns and ads and add the Pixel Relay URL parameters to the ads to see cost per lead for each campaign, ad set and ad. See Ad URL parameters.
Related articles
Still stuck?
Tell us what you are trying to do and we will help you set it up.