What is the Meta Conversions API
The Meta Conversions API (CAPI) is a server side interface that lets advertisers send event data directly from their web servers to Meta’s advertising platform. By bypassing the browser, CAPI improves data reliability, respects privacy settings, and complements the traditional Meta pixel.
Why Choose Server Side Tracking Over a Browser Pixel
Browser based pixels depend on client side scripts that can be blocked by ad blockers, privacy settings, or browser restrictions. Server side tracking reduces data loss, aligns with recent privacy regulations, and provides more control over the payload sent to Meta.
Prerequisite Checklist
- Meta Business Manager access with admin rights to the ad account and the pixel you intend to use.
- Server environment capable of making HTTPS POST requests – typical options include a cloud function, a backend API, or a tag manager server container.
- Event schema reference from Meta’s developer documentation to match required fields such as event_name, event_time, user_data, and custom_data.
- Access token generated in the Meta Events Manager for authentication of API calls.
Step by Step Configuration
1 Create a Meta System User and Generate an Access Token
In Business Settings, navigate to System Users, add a new user, assign it to the ad account, and grant the “Ads Management” role. Generate a permanent access token for this system user – this token will be used in the Authorization header of every API request.
2 Set Up a Server Endpoint to Receive Events
Configure a webhook or an API route that captures conversion actions on your site – for example, a purchase confirmation page. Extract the necessary data (order value, currency, product IDs, and user identifiers) and format it according to Meta’s event schema.
3 Map User Data for Matching
Meta requires hashed user identifiers to improve matching. Collect email addresses, phone numbers, or external IDs, normalize them to lower case, remove whitespace, and apply the SHA‑256 hash function before sending.
4 Build the API Request Payload
Construct a JSON object with the following structure:
- event_name – e.g., “Purchase”.
- event_time – Unix timestamp of the conversion.
- user_data – hashed identifiers.
- custom_data – value, currency, and any additional parameters.
Include the “event_source_url” field to indicate the page where the conversion occurred.
5 Send the POST Request to Meta
Use the endpoint https://graph.facebook.com/v15.0/{PIXEL_ID}/events. Attach the access token as a query parameter or in the Authorization header. Ensure the Content‑Type header is set to application/json.
6 Verify Event Delivery
After transmitting the first event, open the Meta Events Manager and select “Test Events”. Your server side event should appear in real time. Use the “Diagnostics” tab to check for any errors such as missing required fields or mismatched hash formats.
7 Enable Automatic Event Matching
In Events Manager, turn on “Automatic Advanced Matching” for the pixel. This allows Meta to supplement server side data with any browser side signals, improving overall match rates.
Troubleshooting Common Issues
Event not appearing in Test Events – confirm that the access token is valid and that the request payload follows the latest schema. Check server logs for HTTP response codes; a 400 series indicates a malformed request.
Low match rate despite server side data – verify that user identifiers are correctly hashed and that the same format (email, phone) is used consistently across all events.
Duplicate conversions – implement idempotency by including a unique event_id for each conversion. Meta will ignore subsequent events with the same event_id.
Best Practices for Ongoing Management
Schedule regular reviews of the Events Manager diagnostics to catch schema changes early. Keep the access token refreshed whenever you rotate system user credentials. Document your server side event mapping in a shared repository to ensure consistency across development teams.
Leave a Reply