Facebook Pixel Setup Guide: Track Conversions Like a Pro
Founder at Adship

The Meta Pixel is a piece of JavaScript code you install on your website that reports user actions — page views, add-to-carts, purchases — back to Meta. Without it, Meta has no idea whether your ads are driving actual business results. You're flying blind, paying for clicks that may or may not be turning into customers.
This guide covers complete Pixel setup: creating the pixel in Business Manager, installing the base code, configuring standard events, verifying everything works, and setting up the Conversions API (CAPI) for post-iOS 14 data accuracy.
Step 1: Create Your Meta Pixel
Go to Meta Business Suite → Events Manager → Connect Data Sources → Web → Meta Pixel. Give your pixel a name (your business name works fine) and enter your website URL. Meta may offer setup instructions — select "Install code manually" for full control.
Each ad account gets one pixel. If you have multiple websites under one business, use the same pixel across all of them — Meta pools the data for better optimization. Don't create a separate pixel per website unless they serve completely different audiences.
Step 2: Install the Base Code
The base pixel code goes in the <head> section of every page on your website, before the closing </head> tag. Meta will provide the exact code snippet after you create the pixel — it looks like this:
<!-- 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 -->
Replace YOUR_PIXEL_ID with the pixel ID from Events Manager (it's a 15-16 digit number).
Platform-Specific Installation
If you use a website platform, there are easier options:
- Shopify: Apps → Facebook & Instagram → Connect → enter pixel ID
- WordPress: Install the Meta Pixel plugin or PixelYourSite → enter ID
- Squarespace: Marketing → Facebook Pixel → enter ID
- Wix: Marketing & SEO → Meta Pixel → Connect → enter ID
- Webflow: Project Settings → Integrations → Facebook Pixel → enter ID
For custom-built sites, paste the code manually into your site's <head> template.
Step 3: Configure Standard Events
The base code fires a PageView event on every page. That's the minimum. To optimize ads for purchases, leads, or other outcomes, you need to add event code to specific pages or actions.
The 9 Core Standard Events
| Event | Where to Fire | Code |
|---|---|---|
| ViewContent | Product pages | fbq('track', 'ViewContent') |
| AddToCart | Cart button click | fbq('track', 'AddToCart') |
| InitiateCheckout | Checkout start | fbq('track', 'InitiateCheckout') |
| AddPaymentInfo | Payment page | fbq('track', 'AddPaymentInfo') |
| Purchase | Order confirmation | fbq('track', 'Purchase', {value: 99.00, currency: 'USD'}) |
| Lead | Form submit | fbq('track', 'Lead') |
| CompleteRegistration | Account creation | fbq('track', 'CompleteRegistration') |
| Search | Search results | fbq('track', 'Search') |
| Contact | Contact page | fbq('track', 'Contact') |
Implementing Purchase Events Correctly
For e-commerce, the Purchase event is the most critical. Always pass value and currency:
<script>
fbq('track', 'Purchase', {
value: {{ order.total }},
currency: '{{ shop.currency }}',
content_ids: ['{{ product.id }}'],
content_type: 'product'
});
</script>
Put this on your order confirmation page, where it fires only after a completed transaction. Do not fire it on the checkout page — that creates inflated conversion counts.
Step 4: Add the No-Script Fallback
For users with JavaScript disabled, add the <noscript> version immediately after the <body> tag:
<noscript>
<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1"/>
</noscript>
It's a 1x1 pixel that fires for non-JS environments. Most modern browsers run JS, but this covers edge cases and is a required part of Meta's implementation guidelines.
Step 5: Verify Your Pixel Is Working
Facebook Pixel Helper (Chrome Extension)
Install the Meta Pixel Helper Chrome extension (search "Meta Pixel Helper" in Chrome Web Store). After installing, visit your website. The extension shows:
- Whether the pixel fires on each page
- Which events are being sent
- Any errors in your implementation
- The pixel ID that's active
A green checkmark means the pixel is working. Yellow warnings indicate potential issues. Red errors mean something is broken.
Events Manager Verification
In Events Manager, go to your pixel → Test Events. Open a new tab with your website and perform actions (add to cart, visit a product page). Events appear in real time in the Test Events panel, typically within 10-30 seconds.
This is more reliable than the Chrome extension for verifying events fire on user actions (not just page loads).
Step 6: Set Up the Conversions API (CAPI)
The pixel fires from the browser. iOS 14+ and browser privacy changes (cookie restrictions, ad blockers) prevent some events from being reported. The Conversions API (CAPI) sends events from your server directly to Meta, bypassing browser limitations.
Why CAPI Matters
- Ad blockers affect roughly 25-40% of desktop users
- iOS 14+ limits tracking for app users
- Browser cookie restrictions reduce match rates over time
- CAPI restores the data gap — events are sent from your server regardless of client-side conditions
CAPI Setup Options
Via Shopify (easiest): The Facebook & Instagram app on Shopify automatically enables CAPI. Shopify sends server-side purchase events using its own integration.
Via Partner Integration: Meta has official integrations with WooCommerce, Magento, BigCommerce, and others. These handle CAPI automatically.
Via Meta's Gateway: Events Manager → Settings → Conversions API → Set up → choose "Gateway" (no code required, Meta-hosted gateway routes events).
Via Direct API: For developers, the Conversions API sends events via POST request with customer data hashed as SHA-256. The endpoint is https://graph.facebook.com/v26.0/{pixel_id}/events.
Deduplication
When running both Pixel and CAPI, the same event fires twice — once from browser, once from server. Meta deduplicates events using the event_id parameter. Set a unique ID on browser events and pass the same ID to CAPI:
// Browser (Pixel)
fbq('track', 'Purchase', purchaseData, {eventID: 'order_123456'});
// Server (CAPI) - same event_id
POST /events
{
"event_id": "order_123456",
"event_name": "Purchase",
...
}
Without deduplication, your reported conversions will be inflated and Meta's algorithm will receive duplicate signals.
Common Pixel Mistakes
Firing events on the wrong page. Purchase events on the checkout page (not confirmation) double-count conversions. Lead events on the form page (not thank-you page) count form views, not submissions.
Not passing value in Purchase events. Without value, Meta can't optimize for revenue or calculate ROAS. Always include value and currency.
Multiple pixels on one site. Two pixels on the same site send duplicate PageView events. Use one pixel — the one connected to your active ad account.
No CAPI implementation. Running pixel-only in 2026 means you're missing 20-40% of your conversions. CAPI is no longer optional for accurate attribution.
Cookie consent issues. In GDPR regions, pixel fires before user consent. Always gate pixel initialization on consent in EU/UK markets. Use Consent Mode v2 integration.
Checking Event Quality
In Events Manager, the Event Match Quality score (0-10) tells you how well Meta can match events to user profiles. Higher match quality = better targeting and attribution.
Improve match quality by:
- Passing hashed customer data (email, phone, name) with your events
- Using CAPI with strong customer matching
- Setting
fbpandfbcbrowser cookie parameters
For e-commerce, a match quality score above 7 is excellent. Below 4 indicates problems with your customer data passing.
Pixel Setup Verification Checklist
Before running ads, confirm:
- Base pixel code on every page (check with Pixel Helper)
- PageView firing on all pages
- Purchase/Lead events on confirmation pages only
- Value and currency passed with Purchase events
- No-script tag added
- CAPI implemented (or planned)
- Event deduplication set up if running CAPI + Pixel
- Events visible in Events Manager Test Events
- Event match quality > 6
Start Running Better-Targeted Ads with Adship
Adship connects directly to your Meta ad accounts, giving you full visibility into pixel events and making it easier to optimize campaigns for conversion data. Once your pixel is firing correctly, use Adship to build and manage bulk ad campaigns that leverage your conversion data.
Meet the AI Ad Operating System
Scan, spy, create, and launch Meta and TikTok ads with guarded actions taken with your approval.
Start FreeRecommended Resources
Related Articles
View allMeta Pixel Helper: Install, Read, and Fix Errors (2026)
Install the official Meta Pixel Helper, read Pixel and event statuses, fix common errors, and verify conversion tracking before campaign launch.
How to Manage Facebook and TikTok Ads Together (2026 Guide)
Running Facebook and TikTok ads from two separate dashboards costs you time and money. Here's how to manage both platforms without the chaos.
How to Block Meta Ad Enhancements in 2026
Meta keeps adding AI-powered "enhancements" to your ads, music, 3D motion, text overlays, and more. Here's how to disable them all and keep your creatives exactly as you designed them.