Facebook Ads
Token mode setup for conversion postback. Pixel ID and Conversion API access token.
Facebook Ads supports both token mode (OSS core) for server-side conversion postback and OAuth mode (via @autonnel/plugin-ads) for ad-data queries.
Prerequisites
- A Meta Business account with a Pixel created in Meta Events Manager
- A Conversions API access token for that pixel
- For OAuth mode:
@autonnel/plugin-adsinstalled with Facebook app credentials
Token mode setup
Token mode sends purchase events (and any additional mapped events) to the Facebook Conversions API when an order is paid. No OAuth authorization flow is required.
Generate a Conversions API access token
- Go to Meta Events Manager.
- Select your pixel.
- Click Settings → Conversions API → Generate access token.
- Copy the token. It does not expire on its own but may become invalid if you revoke it.
Add the platform in autonnel
- Go to Ads in the autonnel admin.
- Click Add platform → Facebook.
- Select Token mode.
- Enter a display name, your Pixel ID, and the access token you generated.
- Save.
The Pixel ID is visible in Meta Events Manager on the pixel’s overview page (a numeric string, e.g., 123456789012345).
Testing events
Meta provides a test event code to verify your setup before going live.
- In Meta Events Manager, open your pixel and go to the Test events tab.
- Copy the test event code shown there.
- In autonnel’s Ads settings for the Facebook platform, enter the code in the Test event code field and save.
- Complete a test purchase in your funnel.
- The event should appear in Meta’s Test Events view within a few seconds.
Remove the test event code from autonnel once you have confirmed delivery — events sent with a test code are not attributed to campaigns.
Event mapping defaults
When you add a Facebook platform account, the following mappings are applied automatically:
| Internal event | Facebook event |
|---|---|
PURCHASE | Purchase |
PURCHASE → Purchase is a non-editable default. You can add mappings for the remaining internal events from the platform’s event mapping section:
| Internal event | Available Facebook events |
|---|---|
PAGE_VIEW | PageView, Purchase, AddToCart, InitiateCheckout |
CHECKOUT_VIEW | same options |
INITIATE_PAYMENT | same options |
A common additional mapping is PAGE_VIEW → PageView and CHECKOUT_VIEW → InitiateCheckout.
OAuth mode
If you install @autonnel/plugin-ads and supply Facebook app credentials, the Ads page shows a Connect with OAuth button for Facebook. Completing the OAuth flow enables:
- Ad account and pixel discovery
- Spend, impressions, and clicks data inside autonnel
OAuth mode does not replace token mode for postback — it adds the data-query layer on top.
To configure the plugin, see Ads overview — Installing the plugin.
Click-ID routing
The fbclid parameter in the visitor’s URL is used to identify Facebook traffic. If fbclid is present when an order is created, the purchase postback is routed to the Facebook adapter. If fbclid is absent, no Facebook postback fires for that order.
Note: the _fbp and _fbc browser cookies are not used for traffic-source detection — they may persist across visits from other sources and would produce false attributions.
Caveats
- The Conversions API integration targets a specific Meta Graph API version. If Meta deprecates that version, you will need to update autonnel.
fbclidattribution windows vary by campaign type (click, view, or engaged-view attribution). Check your campaign settings in Meta to understand the active window.- Client-side pixel events (AddToCart, ViewContent, etc.) are not sent by autonnel. Inject your Meta Pixel base code via Settings → Scripts if you need those events.