Skip to content
ARDURA Lab
ARDURA Lab
·4 min

Meta Pixel — Facebook/Instagram tracking code for marketers

Meta AdsFacebooktrackinganalytics

What is Meta Pixel?

Meta Pixel (until 2021 called Facebook Pixel) is a JavaScript script installed on a website that collects user behavior data and sends it to Meta Business Manager. The pixel is the foundation of the Meta advertising ecosystem — without it, retargeting, lookalike audiences, and campaign optimization for conversions don't work.

The pixel tracks standard events (PageView, ViewContent, AddToCart, Purchase) and custom events defined by the publisher.

Why does it matter?

  • Retargeting — recovering visitors who didn't convert (most effective Meta campaign type)
  • Lookalike audiences — Meta builds audience similar to your converters
  • Conversion optimization — Meta learns who converts and targets similar people
  • ROI measurement — attribution of conversions to specific campaigns
  • Conversion API (CAPI) — server-side pixel version, crucial in the post-cookie era

Meta Pixel architecture

Standard pixel (browser-side)

  • JS placed in <head> of the page
  • Reads and sends fbq('track', 'Event') via fetch
  • Sets cookies _fbp, _fbc
  • Limitations: iOS ATT, ad blockers, third-party cookies expire 2026

Conversion API (CAPI) — server-side

  • Your application backend sends directly to Meta via HTTPS
  • Bypasses ad blockers and ITP/ATT restrictions
  • Requires deduplication with browser pixel (event_id matching)
  • Standard in 2026 — since November 2024 Meta recommends CAPI as primary

Standard Meta Pixel events

EventWhen to sendParameters
PageViewevery page(auto)
ViewContentproduct pagecontent_ids, value, currency
Searchsearchsearch_string
AddToCartadd to cartcontent_ids, value, currency
InitiateCheckoutcheckout startvalue, currency
AddPaymentInfopayment info filledvalue, currency
Purchasepurchase completionvalue, currency, content_ids
LeadB2B form filled(custom)
CompleteRegistrationaccount registration(custom)

Custom Events allow defining your own events (e.g., WhitepaperDownload, WebinarSignup).

Step-by-step installation

1. Create Pixel

  • Meta Business Manager → Events Manager → Connect Data Sources → Web → Meta Pixel
  • Copy Pixel ID (15-digit)

2. Insert base code

<!-- 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', 'PIXEL_ID_HERE');
fbq('track', 'PageView');
</script>

3. Add conversion events

// After purchase
fbq('track', 'Purchase', {
  value: 99.00,
  currency: 'USD',
  content_ids: ['SKU_123']
});

4. Configure CAPI

  • Backend sends the same event via /v18.0/{pixel_id}/events
  • Generate event_id (UUID) — use it in both pixel + CAPI for deduplication
  • Hash PII (email, phone) before sending (SHA-256)

5. Verify implementation

  • Meta Pixel Helper (Chrome extension)
  • Events Manager → Test Events (live preview)
  • Diagnostics tab → check for duplicates and errors

Privacy & GDPR

Consent

  • Pixel cannot fire before user consent (GDPR)
  • Implementation via Cookiebot/OneTrust/own consent banner
  • Server-side CAPI still requires consent

PII Hashing

  • Email, phone, first name, last name must be hashed SHA-256 before sending
  • Meta Pixel auto-hashes (Advanced Matching)
  • CAPI requires manual hashing

iOS 14.5+ ATT

  • 70%+ users on iOS opt-out of tracking
  • Meta introduces Aggregated Event Measurement — max 8 events per pixel, prioritized
  • Fall back to server-side CAPI where ATT doesn't apply

Key metrics

  • Event Match Quality (EMQ) — browser ↔ CAPI deduplication quality; target ≥6.0/10
  • Coverage — % conversions sent via CAPI vs browser; target >90%
  • Latency — delay between event and Meta; target under 5 min
  • Cost per result — campaign KPI (CPM, CPC, CPA, ROAS)

Common mistakes

  • Browser pixel only — in 2026 loses 30-50% of conversions to ATT/cookies
  • No deduplication — Meta counts event 2× → inflated reported ROAS
  • Firing events before consent — GDPR fine, banned ad account
  • No PII hashing — ToS violation, account ban
  • Pixel in <body> instead of <head> — delayed PageView, less data

Meta Pixel and SEO

The pixel itself doesn't affect SEO — but its heavy JS (35KB) affects Core Web Vitals:

  • LCP — pixel loaded in <head> blocks rendering
  • INP — interaction events can slow down UI
  • Fix: async loading, server-side tracking via GTM Server-Side, deferred init

Related terms

Need help?

Strategy tailored to your goals — check out our offer.