How to Set Up Facebook (Meta) Conversion API
The definitive guide to implementing Meta's Conversion API from scratch, covering all methods, best practices, and optimization techniques.
Understanding Facebook Conversion API
The Facebook Conversion API (also known as Meta Conversions API or CAPI) is a server-side tracking tool that creates a direct connection between your marketing data and Facebook's advertising system. Unlike the Facebook Pixel, which runs in the user's browser, CAPI sends data from your server directly to Facebook's servers, making it immune to browser-side limitations.
This server-to-server approach solves the fundamental challenges facing modern digital advertising: ad blockers prevent pixel events from firing, iOS App Tracking Transparency reduces data availability, browser cookie restrictions limit cross-session tracking, and increasing privacy regulations require more secure data handling methods.
Meta recommends using the Conversion API alongside the Facebook Pixel in a dual-tracking setup. This redundant approach maximizes data coverage—the pixel captures what it can from the browser, while CAPI ensures all events are recorded server-side. Facebook automatically deduplicates overlapping events when properly configured.
How the Conversion API Works
Understanding the data flow is key to a successful implementation:
User Action
A visitor performs an action on your website (e.g., purchases a product, submits a form, views a page).
Server Captures Event
Your web server detects the action through your backend code, CMS, or e-commerce platform and prepares the event data.
Data Hashing
Personal data (email, phone, name) is hashed using SHA-256 before leaving your server. This ensures privacy while enabling matching.
API Request
Your server sends an HTTP POST request to Facebook's Graph API endpoint with the event name, parameters, user data, and event ID.
Facebook Matching
Facebook receives the event and uses the hashed customer data to match it to a Facebook user profile for attribution.
Deduplication
If a matching pixel event exists with the same event ID, Facebook merges the two records to prevent double-counting.
Setup Methods Available
Partner Integration (Easiest)
If you use a supported e-commerce platform (Shopify, WooCommerce, Magento, BigCommerce), the simplest approach is using the platform's built-in Facebook integration. These partner integrations handle CAPI setup automatically, including event mapping, data hashing, and deduplication.
Events Manager Direct Setup
Facebook's Events Manager provides a guided setup flow for CAPI implementation. This method walks you through generating access tokens, selecting events to track, and configuring your server-side connection. It's suitable for businesses with moderate technical resources.
Direct API Integration (Most Flexible)
For maximum control, you can implement CAPI by making direct HTTP POST requests to Facebook's Graph API. This method requires development resources but offers complete flexibility over event timing, parameters, and data handling. Meta provides SDKs for PHP, Python, Node.js, Java, and Ruby.
Facebook Standard Events Reference
Facebook supports these standard events out of the box. Using standard events (instead of custom events) enables automatic optimization and reporting features:
| Event Name | Description | Common Use Case |
|---|---|---|
| Purchase | Completed transaction | E-commerce order confirmation |
| AddToCart | Item added to cart | Product page CTA click |
| InitiateCheckout | Checkout process started | Cart to checkout transition |
| ViewContent | Page or product viewed | Product detail pages |
| Lead | Lead form submitted | Contact forms, quote requests |
| CompleteRegistration | Account created | Signup completion |
| AddPaymentInfo | Payment details entered | Checkout payment step |
| Search | Search performed | Site search functionality |
| Subscribe | Subscription started | Newsletter, SaaS plans |
| Contact | Business contacted | Phone, email, chat initiated |
Step-by-Step Implementation
Create Your Facebook Pixel
If you haven't already, create a Facebook Pixel in Events Manager. Navigate to Events Manager > Connect Data Sources > Web > Facebook Pixel. Name your pixel and add your website URL. This pixel ID will be used for both browser and server-side events.
Generate a CAPI Access Token
In Events Manager, select your pixel and navigate to Settings > Conversions API. Click 'Generate Access Token' to create a permanent token that authenticates your server-side requests. Store this token securely—it provides write access to your pixel's event data.
Define Events to Track
Identify the key conversion events for your business. Standard events include PageView, ViewContent, AddToCart, InitiateCheckout, Purchase, Lead, and CompleteRegistration. Map each event to a specific user action on your website and define the parameters each event should include.
Implement Server-Side Event Sending
Using your chosen method (partner integration, SDK, or direct API), configure your server to send events to Facebook when conversions occur. Each event must include the pixel ID, event name, event time, user data (hashed), and an event source URL.
Configure Event Deduplication
Assign unique event IDs to each conversion and send the same ID through both the pixel and CAPI. Facebook uses these IDs to identify and merge duplicate events, ensuring accurate conversion counting. Without deduplication, conversions may be double-counted.
Test and Validate
Use the Test Events tool in Events Manager to verify your implementation. Send test events and confirm they appear correctly with proper parameters. Check that deduplication is working by verifying that browser and server events with matching IDs are merged.
Common CAPI Setup Mistakes
Skipping event deduplication
Without matching event IDs between pixel and CAPI, Facebook will count every conversion twice—inflating your numbers and corrupting your campaign data. Always include identical event_id values in both tracking methods.
Not hashing customer data
Sending unhashed personal data (emails, phone numbers) violates Meta's policies and can result in data rejection or account penalties. Always apply SHA-256 hashing to PII before sending. Most SDKs handle this automatically.
Sending events with wrong timestamps
CAPI events should use the actual time the action occurred, not when the API call is made. For real-time events, this is usually the same. For batch processing, always include the original event_time.
Ignoring Event Match Quality
EMQ scores below 6.0 indicate poor data matching. Review which customer parameters you're sending and add more data points. Even one additional parameter (like phone number) can significantly improve match rates.
Testing in production only
Always use Facebook's Test Events tool during development. It shows you exactly what Facebook receives, including any parameter errors, before events affect your live campaign data.
Maximizing Event Match Quality
Event Match Quality (EMQ) is Facebook's metric for how well your server events can be matched to Facebook user profiles. Higher EMQ scores lead to better ad optimization, more accurate attribution, and improved campaign performance. Facebook recommends targeting an EMQ score of 6.0 or higher.
To maximize EMQ, include as many customer information parameters as possible with each event. The most impactful parameters are email address, phone number, first name, last name, city, state, zip code, country, and external ID. All personal data must be hashed using SHA-256 before transmission.
- Always include hashed email with every event — it has the highest match impact
- Add phone numbers in E.164 format for cross-device matching
- Include the user's IP address and user agent for probabilistic matching
- Send the Facebook click ID (fbclid) and browser ID (fbp) when available
- Use consistent external IDs to help Facebook track users across sessions
Customer Data Parameters for Matching
Send as many of these parameters as possible to maximize your Event Match Quality score:
| Parameter | API Key | Impact | Hashing |
|---|---|---|---|
| em | Very High | Required | |
| Phone | ph | High | Required |
| First Name | fn | Medium | Required |
| Last Name | ln | Medium | Required |
| City | ct | Low | Required |
| State | st | Low | Required |
| Zip Code | zp | Low | Required |
| Country | country | Low | Required |
| IP Address | client_ip_address | Medium | Not hashed |
| User Agent | client_user_agent | Medium | Not hashed |
| Click ID (fbc) | fbc | Very High | Not hashed |
| Browser ID (fbp) | fbp | High | Not hashed |
Frequently Asked Questions
Is the Facebook Conversion API free to use?
Yes, the Conversion API itself is free. There are no API usage fees from Meta. However, you may incur costs for server infrastructure (if self-hosting), third-party integration tools, or developer time for custom implementations.
Can I use CAPI without the Facebook Pixel?
Yes, CAPI can function independently. However, Meta strongly recommends using both together for maximum data coverage and deduplication. The pixel provides real-time browser-side data and supports dynamic ads and retargeting audiences that CAPI alone cannot.
How does CAPI handle GDPR and privacy compliance?
CAPI supports privacy compliance by allowing you to control exactly what data is sent and when. You can implement consent checks before sending events, exclude specific user data parameters, and use Data Processing Options to flag events from EU users. All personal data is hashed before transmission.
What happens if my server goes down—do I lose conversion data?
Yes, if your server can't send CAPI events, those conversions won't be recorded server-side. However, the browser pixel (if active) may still capture them. For high-reliability setups, implement event queuing so failed CAPI calls are retried automatically.
How quickly should I send events after they occur?
Send events as close to real-time as possible—ideally within minutes. Facebook accepts events up to 7 days after they occur, but fresher data leads to better attribution and optimization. For offline conversions (like CRM events), send within 48 hours for best results.
Can I send historical conversion data through CAPI?
You can send events with past timestamps (up to 7 days old) using the event_time parameter. For older historical data, use Facebook's Offline Conversions feature instead. Historical CAPI uploads are useful for backfilling data during initial setup.