Pixel & Conversions API
Set up accurate tracking with Meta Pixel and Conversions API for iOS privacy compliance.
Tracking Overview
Accurate tracking is the foundation of Meta Ads optimization. In 2025, you need both browser-side and server-side tracking:
| Tracking Method | How It Works | Limitations | |-----------------|--------------|-------------| | Meta Pixel | JavaScript on website | Blocked by ad blockers, iOS privacy | | Conversions API | Server-to-server | Requires technical setup | | Both (Recommended) | Redundant tracking | Best coverage, deduplication needed |
Why Both Are Essential
Pixel Only: 60-70% of conversions tracked
CAPI Only: 70-80% of conversions tracked
Pixel + CAPI: 85-95% of conversions trackedKey Stat: Server-side tracking (CAPI) recovers 20-30% of conversion data lost to iOS privacy changes and ad blockers.
Meta Pixel Setup
What is the Meta Pixel?
A JavaScript snippet that tracks user actions on your website and sends them to Meta for:
- Conversion tracking
- Audience building
- Ad optimization
- Attribution
Installation Methods
1. Direct Code Installation
<!-- Meta Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>
<!-- End Meta Pixel Code -->2. Google Tag Manager
- Create Meta Pixel tag template
- Add your Pixel ID
- Set trigger to All Pages
- Configure event tags separately
3. Platform Integrations
- Shopify: Native Meta app
- WordPress: PixelYourSite plugin
- WooCommerce: Meta for WooCommerce
Standard Events
| Event | When to Use | |-------|-------------| | PageView | Every page load | | ViewContent | Product/content pages | | AddToCart | Add to cart clicks | | InitiateCheckout | Checkout starts | | AddPaymentInfo | Payment info entered | | Purchase | Completed transactions | | Lead | Form submissions | | CompleteRegistration | Signup completion | | Search | Search actions | | Contact | Contact form/call |
Custom Events
For actions not covered by standard events:
// Custom event example
fbq('trackCustom', 'PricingPageView', {
plan_type: 'enterprise',
page_section: 'comparison'
});Conversions API (CAPI)
What is CAPI?
Server-side tracking that sends conversion data directly from your server to Meta—bypassing browser limitations.
User Action → Your Server → Meta API → Ads Manager
(No browser involved after initial action)Setup Options
1. Partner Integrations (Easiest)
- Shopify, WooCommerce, Magento native integrations
- Zapier/Make for custom workflows
- CDP platforms (Segment, mParticle)
2. Google Tag Manager Server-Side
- Requires server-side GTM container
- More control, moderate complexity
- Good for custom implementations
3. Conversions API Gateway
- Meta's managed solution
- AWS-hosted, simplified setup
- Less customization
4. Direct API Integration (Most Control)
- Custom server implementation
- Full control over data
- Requires development resources
Required CAPI Parameters
{
"event_name": "Purchase",
"event_time": 1699876543,
"event_source_url": "https://yoursite.com/checkout/complete",
"user_data": {
"em": "hashed_email",
"ph": "hashed_phone",
"fn": "hashed_first_name",
"ln": "hashed_last_name",
"ct": "hashed_city",
"st": "hashed_state",
"zp": "hashed_zip",
"country": "hashed_country",
"client_ip_address": "192.168.1.1",
"client_user_agent": "Mozilla/5.0...",
"fbc": "fb.1.1234567890.abcdefg",
"fbp": "fb.1.1234567890.1234567890"
},
"custom_data": {
"value": 99.99,
"currency": "USD",
"content_ids": ["SKU123"],
"content_type": "product"
}
}Important: All user data must be SHA256 hashed before sending. Meta does not accept plain text PII.
Event Deduplication
When using both Pixel and CAPI, deduplicate events:
// Generate unique event ID
const eventID = 'evt_' + Date.now() + '_' + Math.random();
// Pixel event with ID
fbq('track', 'Purchase', {value: 99.99, currency: 'USD'}, {eventID: eventID});
// CAPI event with same ID
// (sent from server with matching event_id)iOS Privacy & ATT
The iOS 14.5+ Impact
Apple's App Tracking Transparency (ATT) requires apps to ask permission for cross-app tracking:
Pre-ATT: ~70% of users trackable
Post-ATT: ~25% opt-in to tracking
Result: 45% less data for optimizationAggregated Event Measurement (AEM)
Meta's solution for iOS limitations:
| Limitation | Workaround | |------------|------------| | 8 conversion events max | Prioritize highest-value events | | Delayed reporting | Up to 3 days delay | | Modeled conversions | Statistical estimation | | Limited breakdown | Less granular data |
Event Configuration Priority
Configure your 8 events by priority:
Priority 1 (Highest): Purchase
Priority 2: Add to Cart
Priority 3: Initiate Checkout
Priority 4: Lead
Priority 5: View Content
Priority 6: Add Payment Info
Priority 7: Complete Registration
Priority 8: SearchDomain Verification
Required for AEM:
- Go to Business Settings → Brand Safety → Domains
- Add your domain
- Verify via DNS TXT record or meta tag
- Configure conversion events
Event Match Quality
What is EMQ?
Event Match Quality (EMQ) measures how well Meta can match your conversion data to Facebook users. Higher EMQ = better optimization.
| EMQ Score | Quality | Action | |-----------|---------|--------| | 0-3 | Poor | Add more user parameters | | 4-6 | Fair | Improve data quality | | 7-8 | Good | Minor optimizations | | 9-10 | Excellent | Maintain current setup |
Improving EMQ
High-Impact Parameters:
- Email (hashed) - Most important
- Phone (hashed) - Very important
- fbp (Pixel cookie) - Browser identifier
- fbc (Click ID) - Click attribution
- Client IP - Network matching
- User Agent - Device matchingMedium-Impact Parameters:
- First Name + Last Name (hashed)
- City, State, Zip (hashed)
- Country
- Date of Birth
- GenderEMQ Best Practices
□ Send both email AND phone when available
□ Include fbc and fbp parameters from cookies
□ Always include client_ip_address and client_user_agent
□ Use consistent hashing (SHA256, lowercase, trimmed)
□ Send events in real-time (within 1 hour)
□ Match event_id between Pixel and CAPITroubleshooting
Common Issues
1. Events Not Firing
□ Check Pixel is installed (Meta Pixel Helper extension)
□ Verify no JavaScript errors blocking execution
□ Confirm trigger conditions are met
□ Check for ad blockers during testing2. Duplicate Events
□ Verify event_id matches between Pixel and CAPI
□ Check for multiple Pixel installations
□ Review GTM trigger configurations
□ Use Facebook Events Manager to identify duplicates3. Low Event Match Quality
□ Add more user data parameters
□ Verify hashing is correct (SHA256)
□ Include fbc/fbp cookie values
□ Check data is properly formatted4. CAPI Events Not Appearing
□ Verify API access token is valid
□ Check Pixel ID is correct
□ Confirm server can reach Meta API
□ Review API response for errorsTesting Tools
| Tool | Purpose | |------|---------| | Meta Pixel Helper | Browser extension for Pixel debugging | | Events Manager | View all events, test events | | Test Events | Send test conversions | | Conversions API Diagnostics | Server-side event validation |
Pro Tip: Always test in Events Manager before launching campaigns. Send test events and verify they appear with correct parameters and EMQ scores.