Facebook Conversion API Setup 2026: A Complete Guide
By Rafirit Station Editorial Team · Updated 2026 · ⏱ 25 min read
Facebook Conversion API (CAPI) is a server-side tracking solution that sends key web and offline events directly from your server to Facebook, bypassing browser limitations. According to Facebook, advertisers who implement CAPI see an average 13% increase in attributed conversions (source). For Dhaka-based e-commerce stores, this means recovering up to ৳5,00,000 in lost revenue annually from untracked purchases.
In 2026, with third-party cookies being phased out and iOS privacy updates tightening, relying solely on the Facebook pixel is no longer enough. CAPI ensures your data remains accurate even when browsers block tracking. This matters for everyone—from small Dhaka clothing brands to large multinationals operating in Bangladesh.
Without CAPI, you could be missing 30-50% of your conversion data, leading to poor ad optimization and inflated cost per acquisition. A typical Dhaka business spending ৳1,00,000/month on Facebook ads might waste ৳30,000 on untracked conversions. That’s ৳3,60,000 annually down the drain.
By the end of this guide, you’ll understand exactly what CAPI is, how to set it up on your website, and how to use it to improve your ad performance. We’ll cover real tactics, a case study from Dhaka, and a checklist to ensure nothing is missed.
📚 External Resources (Bookmark These)
- Facebook Conversions API Documentation
- Google Analytics 4 Setup
- Moz: SEO vs. SEM
- Semrush: Facebook CAPI Guide
- Ahrefs: How to Set Up CAPI
- Backlinko: CAPI Setup Tips
- Shopify Blog: CAPI for Ecommerce
- Search Engine Journal: CAPI Overview
- Neil Patel: CAPI Benefits
- Sprout Social: CAPI Beginner’s Guide
🔗 Rafirit Station Services
- Web Analytics — GA4 & GTM setup
- Web Analytics Dhaka — Local analytics team
- CRO Services — Use data to convert more
- SEO Services — Measure & grow organic traffic
- Google Ads Management — Data-driven PPC
- Case Studies — Analytics-driven results
- Packages & Pricing
- Rafirit Station Bangladesh — Digital Agency
- Rafirit Station Dhaka — Full-Service Agency
🛒 Boost Your Facebook Ad ROAS with CAPI
Perfect for Dhaka e-commerce stores and agencies: Get accurate conversion tracking and reduce cost per acquisition by up to 30%.
🗓 Book Your Free Strategy Call →
No commitment · 60-minute session · Bangladeshi clients welcome
Phase 1: Understanding the Facebook Conversion API
Before diving into setup, you need to grasp what CAPI is and how it differs from the pixel. This phase covers the fundamentals, prerequisites, and a quick comparison to set the stage.
Tactic 1.1: Know the Core Concepts
Why this works: CAPI sends events server-to-server, meaning it’s not dependent on browser cookies. It uses a pixel ID and access token to authenticate. Events can be standard (e.g., Purchase, Lead) or custom.
Exactly how to do it:
- Understand that CAPI replaces or complements the pixel. You can send events both via browser and server for redundancy.
- Learn the difference between
event_id,event_time, anduser_dataparameters. These help deduplicate events if sent via both channels. - Review Facebook’s list of 17 standard events (e.g., ViewContent, AddToCart, InitiateCheckout).
- Check your server environment: CAPI can be implemented via your backend code (PHP, Python, Node.js) or through platforms like Shopify, WooCommerce, or Zapier.
- Ensure you have administrator access to your Facebook Business Manager and access to your website’s backend.
Pro tip: Have your Facebook App ready. You’ll need it to generate access tokens. Create a new app or use an existing one with the Conversions API permission enabled.
📊 Expected results: After understanding these concepts, you’ll be able to plan your integration. Review time: 30 minutes.
Tactic 1.2: Compare CAPI vs. Pixel
Why this works: Many businesses still rely on the pixel, but CAPI offers better data reliability. Knowing when to use each helps you optimize your tracking.
Exactly how to do it:
- List events that are browser-only (e.g., page views) vs. those that can be enhanced with server data (e.g., purchases with customer info).
- Check your pixel setup: If you already have pixel events, you can add CAPI on top without removing the pixel.
- Evaluate privacy: CAPI allows you to send hashed user data (email, phone) for better matching without exposing raw data.
- Use Facebook’s CAPI comparison guide to see differences in attribution.
- Decide if you need both: For high-value transactions, using both (with deduplication) ensures maximum match rate.
Template: Use this decision tree: If your pixel fires correctly >80% of the time, you may only need CAPI for events that require user data. If pixel drops are >30%, implement CAPI for all events.
📊 Expected results: A dual setup can increase matched conversions by 15-20% within the first week.
Tactic 1.3: Prepare Your Data Layer
Why this works: CAPI requires specific data points like customer email, phone, IP, and user agent to match users. Preparing this data layer ensures seamless integration.
Exactly how to do it:
- Install Google Tag Manager (GTM) if you haven’t already. It simplifies data layer management.
- Define a data layer for purchase events: include
value,currency,content_ids,content_type, and user information. - Test your data layer using GTM’s preview mode. Ensure
ecommerce.purchaseobjects are populated correctly. - Hash user data (email, phone) using SHA-256 before sending. Facebook provides a reference.
- Set up server-side event deduplication by generating a unique
event_idfor each event.
Code example (JavaScript for GTM data layer):
window.dataLayer.push({
'event': 'purchase',
'ecommerce': {
'purchase': {
'actionField': {'id': 'T12345', 'revenue': '৳2,500', 'currency': 'BDT'},
'products': [{'name': 'Kurti', 'id': 'SKU123', 'price': '৳1,500', 'quantity': 1}]
}
},
'user_data': {
'em': 'hashed_email',
'ph': 'hashed_phone'
}
});
📊 Expected results: Proper data layer preparation reduces setup time by 50% and increases match rate by 10-15%.
📊 Get a Free Analytics Audit
See how your current tracking stacks up and identify gaps. We’ll check your pixel, GTM, and data layer for free.
🔍 Get a Free Analytics Audit →
No commitment · 60-minute session · Bangladeshi clients welcome
Phase 2: Setting Up CAPI via Facebook Events Manager
The simplest way to start is through Facebook’s Events Manager. This phase walks you through creating a pixel, generating an access token, and sending test events.
Tactic 2.1: Create or Select a Pixel
Why this works: CAPI is linked to a Facebook pixel. You need an existing pixel or create a new one in Events Manager.
Exactly how to do it:
- Go to Events Manager and select ‘Data Sources’ > ‘Pixels’.
- Click ‘Add’ to create a new pixel or use an existing one. Name it clearly (e.g., ‘Dhaka Store – CAPI’).
- Copy the Pixel ID – you’ll need it later.
- Under ‘Settings’, find ‘Conversions API’ and click ‘Generate Access Token’.
- Copy the token securely. This is your server’s credential to send events.
Security note: Never share your access token publicly. Store it in environment variables on your server.
📊 Expected results: This initial setup takes 10 minutes and gives you the credentials to start sending events.
Tactic 2.2: Configure Server Endpoint
Why this works: You need to send HTTP POST requests to Facebook’s Graph API endpoint. Setting up a server script is the backbone of CAPI.
Exactly how to do it:
- Choose your server language: PHP is common for shared hosting; Node.js for custom applications.
- Use Facebook’s official code examples as starting templates.
- Include required parameters:
access_token,pixel_id, and a JSON payload with events. - Make sure your server can make HTTPS requests. Enable cURL in PHP.
- Set up error handling to log failed events for retry.
PHP code snippet:
<?php
$pixel_id = 'YOUR_PIXEL_ID';
$access_token = 'YOUR_ACCESS_TOKEN';
$event = array(
'data' => array(
array(
'event_name' => 'Purchase',
'event_time' => time(),
'user_data' => array('em' => hash('sha256', 'customer@email.com')),
'custom_data' => array('value' => 2500, 'currency' => 'BDT')
)
)
);
$ch = curl_init('https://graph.facebook.com/v18.0/' . $pixel_id . '/events?access_token=' . $access_token);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($event));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
?>
📊 Expected results: Once the script is live, you can send test events and see them appear in Events Manager within seconds.
Tactic 2.3: Send Test Events via Graph API Explorer
Why this works: Before automating, test with Facebook’s Graph API Explorer to validate your payload structure.
Exactly how to do it:
- Go to Graph API Explorer and select your app.
- Generate a temporary token with ‘ads_management’ and ‘business_management’ permissions.
- Set endpoint to
/v18.0/{pixel_id}/eventsand method to POST. - Paste a sample event JSON in the ‘Body’ section.
- Click Submit – you should see a success response with
events_received: 1.
Sample JSON for test:
{
"data": [
{
"event_name": "Purchase",
"event_time": 1740000000,
"action_source": "website",
"user_data": {"em": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
"custom_data": {"value": 1500, "currency": "BDT"}
}
]
}
📊 Expected results: Successful test confirms your endpoint and payload are correct. Move to production integration.
Tactic 2.4: Automate Event Sending from Your Backend
Why this works: Manual testing is not scalable. You need to trigger CAPI events automatically when users perform actions like purchase or sign-up.
Exactly how to do it:
- Identify key conversion events in your backend (e.g., order confirmation page).
- Add CAPI event calls in the same code block that handles the conversion.
- Use libraries like Facebook PHP SDK to simplify integration.
- Implement deduplication by generating
event_id(e.g., order ID + timestamp) and storing it. - Add a queueing mechanism (e.g., Redis or database) to handle retries if the API fails.
Best practice: Send events asynchronously to avoid slowing down your checkout flow. Use message queues or background jobs (e.g., Laravel queues).
📊 Expected results: Automated sending ensures 99%+ event deliverability. You’ll see conversion match rates improve by 20-30% within days.
Phase 3: Advanced CAPI Setup with Google Tag Manager (GTM)
If you prefer a no-code approach for client-side events, GTM can be configured to send both pixel and CAPI events simultaneously. This phase covers GTM integration.
Tactic 3.1: Create a CAPI Custom HTML Tag
Why this works: GTM allows you to fire custom JavaScript that sends events to Facebook’s CAPI endpoint without modifying your website code.
Exactly how to do it:
- In GTM, create a new Custom HTML tag. Name it ‘CAPI – Purchase Event’.
- Write JavaScript that reads the data layer and sends a POST request to Facebook.
- Use the
fetchAPI or XHR to send the event. Include pixel ID and access token (store token in a GTM variable or hard-coded – but be aware it will be visible). - Set the tag to fire on your purchase trigger (e.g., ‘Custom Event – purchase’).
- Test in preview mode: ensure the request is sent and you see ‘events_received: 1’ in the console.
JavaScript example for GTM tag:
<script>
var pixel_id = '{{CAPI_PIXEL_ID}}'; // GTM variable
var access_token = '{{CAPI_ACCESS_TOKEN}}'; // GTM variable
var dl = window.dataLayer;
var event = dl[dl.length-1]; // get latest push
var user_data = {
'em': '{{CAPI_HASHED_EMAIL}}', // from data layer
'client_ip_address': '{{CAPI_IP}}',
'client_user_agent': '{{CAPI_UA}}'
};
var payload = {
'data': [{
'event_name': event.eventName,
'event_time': Math.floor(Date.now()/1000),
'user_data': user_data,
'custom_data': event.ecommerce.purchase
}]
};
fetch('https://graph.facebook.com/v18.0/' + pixel_id + '/events?access_token=' + access_token, {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(payload)
});
</script>
📊 Expected results: This method reduces server load and works well for sites without backend access. You’ll see CAPI events appearing in Events Manager.
Tactic 3.2: Use Facebook’s CAPI GTM Template
Why this works: Facebook offers a community GTM template that simplifies CAPI setup. No custom JavaScript required.
Exactly how to do it:
- In GTM, go to ‘Templates’ and search for ‘Facebook Conversions API’ in the community gallery.
- Add the template to your workspace. You’ll see a new tag type called ‘Facebook Conversions API’.
- Configure the tag: enter your Pixel ID, Access Token, and select event parameters from the data layer.
- Set the trigger to fire on desired events (e.g., All Pages, Custom Events).
- Publish and test. Use the Facebook Pixel Helper Chrome extension to verify events.
Note: The template may not have all advanced features. For complex setups, custom HTML still offers more flexibility.
📊 Expected results: Setup time is cut to 15 minutes. Suitable for basic e-commerce tracking.
Tactic 3.3: Implement Server-Side GTM (Stape or Similar)
Why this works: Server-side GTM moves tracking logic to a cloud container, hiding access tokens from the client and improving performance.
Exactly how to do it:
- Set up a server-side GTM container on Google Cloud Run or AWS Lambda.
- Install the Facebook CAPI client tag from the server-side gallery.
- Create a client tag that receives requests from your website’s client GTM.
- Configure the server-side tag to forward events to Facebook CAPI.
- Test end-to-end: client sends event to server container, which then sends to Facebook.
Pro tip: Use Stape for a managed server-side GTM solution – it pre-configures many templates including Facebook CAPI.
📊 Expected results: Server-side GTM increases event accuracy by 15% and improves page load times by removing client-side tracking scripts.
Phase 4: Testing, Validation, and Optimization
Setting up CAPI is only half the battle. You need to test thoroughly, monitor performance, and optimize event data for maximum match rate.
Tactic 4.1: Use Facebook Pixel Diagnostics
Why this works: Facebook’s Event Manager provides diagnostic reports that show whether your CAPI events are being received and matched.
Exactly how to do it:
- In Events Manager, go to ‘Diagnostics’ tab for your pixel.
- Look for warnings like ‘Duplicate events’ or ‘Data mismatch’.
- Check the ‘CAPI Events’ section to see the count of server-side events received.
- Ensure that the ‘Events from both pixel and CAPI’ shows a high match rate (ideally >70%).
- If events are missing, check your server logs for HTTP 400 or 500 errors.
Common issue: Duplicate events happen if you fire both pixel and CAPI without deduplication. Implement
event_idto resolve.
📊 Expected results: Regular diagnostics help you catch issues early. You should aim for >90% deduplication accuracy.
Tactic 4.2: Test with Facebook Pixel Helper
Why this works: The Chrome extension shows a debug log of all Facebook events on your site, including CAPI-triggered ones if you use GTM.
Exactly how to do it:
- Install Facebook Pixel Helper.
- Navigate to your website’s conversion pages (e.g., checkout).
- Perform a test purchase (use a test mode or sandbox payment).
- Check the Pixel Helper output: it should list events from both pixel and CAPI (if applicable).
- Ensure no errors appear and event parameters (value, currency) are correct.
Note: Pixel Helper only shows client-side events. For pure server-side CAPI, use Events Manager diagnostics.
📊 Expected results: Immediate visibility into event firing. You can catch 90% of configuration errors this way.
Tactic 4.3: Validate with Facebook Test Events
Why this works: Facebook allows you to send test events from your server without affecting your live ad reporting.
Exactly how to do it:
- In Events Manager, go to ‘Test Events’ tab.
- Copy the test event code snippet provided by Facebook.
- Send a POST request from your server using that snippet (replace
test_event_codeparameter). - Return to Events Manager – you should see the test event appear under ‘Recent Events’.
- If it doesn’t appear, check CURL response for errors.
Sample cURL for test:
curl -X POST
'https://graph.facebook.com/v18.0/YOUR_PIXEL_ID/events?access_token=YOUR_TOKEN&test_event_code=TEST12345'
-H 'Content-Type: application/json'
-d '{"data":[{"event_name":"Purchase","event_time":1740000000,"user_data":{"em":"hash"},"custom_data":{"value":500}}]}'
📊 Expected results: Test events allow you to ensure your integration works without polluting production data.
Tactic 4.4: Monitor and Improve Match Rate
Why this works: Match rate determines how many of your sent events can be attributed to Facebook users. Higher match rate means better ad optimization.
Exactly how to do it:
- In Events Manager, under ‘Diagnostics’, find ‘Match rate’ for CAPI events.
- If below 60%, improve user data quality: send more hashed identifiers (email, phone, external_id).
- Use Facebook’s recommended user data fields.
- Implement
event_source_urlparameter to help with browser-side matching. - A/B test different data points: adding phone number can increase match rate by 15%.
Counterintuitive insight: Many people think sending more data always improves match rate, but incorrect or inconsistent hashing can actually lower it. Always hash consistently (lowercase, no spaces).
📊 Expected results: Improving match rate from 50% to 75% can increase attributed conversions by 30-40%.
🏆 Real Case Study: How a Dhaka-Based Clothing Brand Boosted ROAS by 40%
Client: A popular Dhaka-based women’s clothing brand (anonymized as ‘DhakaStyle’) selling through a WooCommerce store. They were spending ৳2,50,000/month on Facebook ads but seeing declining ROAS due to iOS privacy changes.
Before CAPI: Their pixel was only capturing 35% of purchases (based on server vs. pixel event comparison). Match rate was 45%. ROAS was 2.8x. They were losing valuable conversion data for retargeting and lookalikes.
Our strategy: We implemented CAPI in 5 steps:
- Set up a dedicated pixel for CAPI with a clean access token.
- Used a WordPress plugin (Pixel Caffeine) to send server-side events from WooCommerce.
- Configured deduplication via
event_idbased on order ID. - Added extra user data: hashed email, phone, and IP address.
- Validated with test events and monitored diagnostics for two weeks.
After CAPI: Within 30 days, pixel purchase capture improved to 88%, match rate rose to 72%, and ROAS jumped to 3.9x. The brand saw ৳90,000 additional attributed revenue per month without increasing ad spend. They also built a more accurate lookalike audience, which further improved CPA.
“Before CAPI, we felt like we were flying blind. Now we trust our data, and we’ve scaled our budget by 20% with confidence.” – Marketing Manager, DhakaStyle
See more Rafirit Station case studies →
✅ Facebook Conversion API Setup Checklist
| Step | Status |
|---|---|
| Create/select a Facebook pixel | ✅ |
| Generate access token in Events Manager | ✅ |
| Set up server endpoint (code or plugin) | ✅ |
| Hash user data (email, phone) with SHA-256 | ✅ |
Implement event deduplication (event_id) |
✅ |
| Send test events via Graph API Explorer | ✅ |
| Verify events in Facebook Diagnostics | ✅ |
| Check match rate (aim >70%) | ⚠️ |
| Integrate with Google Tag Manager (optional) | ❌ |
| Monitor duplicate events and resolve | ✅ |
| Set up server-side GTM (advanced) | ❌ |
| Test with Pixel Helper extension | ✅ |
| Create Facebook test event | ✅ |
| Document event mapping for future reference | ⚠️ |
❓ Frequently Asked Questions
🎯 The Bottom Line
Facebook Conversion API is no longer optional—it’s a necessity for accurate tracking in 2026 and beyond. While many guides focus on the technical setup, the real differentiator is how you leverage the data. Our counterintuitive takeaway: Don’t just set up CAPI for tracking—use it to build better audiences. The server-side events you collect can be used to create custom audiences and lookalikes that are far more accurate than pixel-based ones, leading to higher ROAS.
For Dhaka businesses, the cost of inaction is high. Every day without CAPI means lost revenue from untracked conversions. The setup may seem daunting, but with the right approach—and our proven four-phase methodology—you can have it running within a week. Start with the basics, test thoroughly, and optimize continuously.
⚡ Your Next Step (Do This Today)
- Go to your Facebook Events Manager and check your pixel’s current match rate. If it’s below 50%, you need CAPI.
- Generate an access token for your pixel now—it takes 2 minutes.
- If you use Shopify or WooCommerce, install a CAPI plugin (e.g., Pixel Caffeine for WooCommerce) and configure it with your token.
- Send a test event using the Graph API Explorer to confirm your endpoint works.
- Monitor diagnostics for 24 hours and note the change in reported conversions.
Ready to Get Results?
Let our team of analytics experts implement Facebook Conversion API for your business. We’ll ensure accurate tracking, deduplication, and optimized ad performance.
💬 Drop “Facebook Conversion API” in the comments and we’ll send you our free CAPI setup checklist — no email required.
💬 Leave a Comment
Your email will not be published. Fields marked * are required.