Facebook CAPI: Full Setup Guide
A detailed Facebook CAPI setup isn't a one-time toggle — it's a chain of token, event structure, and data quality that decides whether Facebook actually trusts your conversions. Skip a step and optimization runs on guesswork: some deposits get lost, others get double-counted, and EMQ drops for no obvious reason. Here's every step, from generating the token to checking it in Events Manager.
What you need before you start
CAPI needs a Pixel already created in Meta Events Manager and a dedicated access token tied to that exact pixel — without a pixel there's nothing for server events to attach to. Beyond that you need a channel capable of firing an outgoing POST request: that can be your own server, or a tracker's built-in integration such as Keitaro, in which case there's no code to write at all.
Event structure: what actually gets sent
Every server call carries an event_name matching your funnel's logic, an event_time set to the unix timestamp of the real action rather than of when the postback happened to fire, an event_source_url, action_source set to "website", and two data blocks — user_data and custom_data. custom_data carries value and currency for anything with monetary weight, like a Purchase event; without them, Facebook has no amount to optimize bidding against.
user_data and Event Match Quality (EMQ)
The fields inside user_data are exactly what drive the Event Match Quality score: hashed email and phone where you have them, external_id — your own persistent user identifier, client_ip_address and client_user_agent carried over from the original visit, and the fbc parameter captured from the ad click. Facebook only raises EMQ for data that genuinely matches a real person — invented values don't help and can look suspicious.
Token, event_id, and dedup with the pixel
The access token authorizes the entire server call and grants write access on behalf of that pixel, so it has no business being exposed anywhere public — it stays inside private tracker or server settings. event_id is a separate piece: a string that ties a server event to its client-side pixel twin so Facebook merges them into one event instead of two. Losing or accidentally regenerating either one midstream is the single most common way CAPI quietly breaks.
Checking Events Manager and pairing with Keitaro
The Test Events tab in Meta Events Manager shows every incoming server call in real time with an EMQ breakdown per field — the fastest way to spot exactly what's missing. Common mistakes are an event_time far from the real moment of action, a missing action_source, and custom_data with no currency on a value-bearing event. Paired with Keitaro, the token and Pixel ID get entered once in the outgoing postback settings, and the resulting EMQ is only as good as what APEX carries from the ad click through to that postback — clickid, IP, and user agent.
FAQ
- Where do I get an access token for Facebook CAPI?
- In Meta Events Manager: pick the pixel → Settings → the Conversions API section → Generate Access Token. The token is tied to that one pixel and belongs only in private server or tracker settings.
- What actually raises EMQ, and what's pointless?
- Real hashed email or phone, external_id, client_ip_address, client_user_agent, and fbc from the click all raise the score; made-up placeholder values do nothing, since Facebook has nothing genuine to match them against.
- Do I need event_id if events only go through CAPI, with no pixel involved?
- No — event_id only matters when the same action is sent through two channels; a single server-only channel never produces a duplicate to merge.
- Can I set up CAPI without my own server, using just Keitaro?
- Yes, Keitaro's outgoing Conversions API integration can pull the required fields from the postback and send them under the same rules without a separate backend.
Cloaking, anti-bot, push, split tests and your own domains — in one service.
Get started free