What You Will Learn
- What the Meta Pixel does and how it connects to Meta advertising
- How to install the base pixel code on your website
- All 17 standard Meta events and what each tracks
- How to fire custom events for actions not covered by standard events
- Setting up the Meta Pixel through Google Tag Manager
- Using Meta Pixel Helper and Events Manager to verify correct firing
- What pixel health score means and how to improve it
What is the Meta Pixel
The Meta Pixel (also called the Facebook Pixel) is a snippet of JavaScript code placed on your website that sends data back to Meta when users take specific actions. Each time a pixel event fires, Meta records it and associates it with any Meta ad click or view that brought the user to your site within the attribution window.
This data serves three purposes: conversion tracking (measuring which ads drive purchases, leads, sign-ups); remarketing audience building (creating Custom Audiences from visitors who took or did not take specific actions); and optimisation signal (providing Meta's algorithm with the data it needs to find users most likely to convert).
Pixel ID
One pixel per website; one ad account can have multiple pixels
Attribution window
Default: 7-day click, 1-day view (configurable)
AEM limit
Maximum prioritised events per domain under iOS 14+ AEM
Base Code Installation
The base pixel code (also called the pixel base code or global site tag) must be installed on every page of your website — in the <head> section, before the closing </head> tag. This base code initialises the pixel and sends a PageView event automatically on every page load.
<!-- 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>
<noscript>
<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1"/>
</noscript>
<!-- End Meta Pixel Code -->
Replace YOUR_PIXEL_ID with your actual Pixel ID (found in Events Manager → Data Sources → your pixel). The <noscript> fallback fires a server-side PageView for users with JavaScript disabled.
Finding your Pixel ID
In Meta Business Manager: Events Manager → Data Sources → select your pixel → Settings tab. The Pixel ID is the 15–16 digit number at the top. Your pixel must be associated with your Business Manager account (not just a personal ad account) for full functionality.
Standard Events
Standard events are Meta's predefined conversion event types — each with a consistent name and parameter structure. Using standard events (rather than custom event names) enables Meta's optimisation and reporting features that are not available for arbitrary custom event names.
| Event Name | Code | When to Fire | Key Parameters |
|---|---|---|---|
| PageView | fbq('track','PageView') | Every page load (fires automatically with base code) | None required |
| ViewContent | fbq('track','ViewContent') | Product detail page view | content_ids, content_type, value, currency |
| Search | fbq('track','Search') | Site search performed | search_string, content_ids |
| AddToCart | fbq('track','AddToCart') | Item added to cart | content_ids, content_type, value, currency |
| AddToWishlist | fbq('track','AddToWishlist') | Item saved/favourited | content_ids, value, currency |
| InitiateCheckout | fbq('track','InitiateCheckout') | Checkout process begun | num_items, value, currency |
| AddPaymentInfo | fbq('track','AddPaymentInfo') | Payment details entered | value, currency |
| Purchase | fbq('track','Purchase',{value:99.00,currency:'GBP'}) | Order confirmed | value, currency (required), content_ids, order_id |
| Lead | fbq('track','Lead') | Lead form submitted | value, currency, content_name |
| CompleteRegistration | fbq('track','CompleteRegistration') | Account/newsletter signup | value, currency, status |
| Contact | fbq('track','Contact') | Contact form submitted | None required |
| CustomizeProduct | fbq('track','CustomizeProduct') | Product customiser used | content_ids, value |
| Donate | fbq('track','Donate') | Donation completed | value, currency |
| FindLocation | fbq('track','FindLocation') | Store locator used | None required |
| Schedule | fbq('track','Schedule') | Appointment booked | None required |
| StartTrial | fbq('track','StartTrial') | Free trial started | value, currency, predicted_ltv |
| Subscribe | fbq('track','Subscribe') | Paid subscription started | value, currency, predicted_ltv |
Custom Events
Custom events track actions on your site that do not fit standard event categories. They use fbq('trackCustom', 'EventName', {parameters}) with any name you choose:
// Custom event — button click
document.getElementById('watch-demo-btn').addEventListener('click', function() {
fbq('trackCustom', 'WatchDemoClick', {
page: window.location.pathname,
button_text: 'Watch Demo'
});
});
// Custom event — scroll depth
window.addEventListener('scroll', function() {
if (window.scrollY > document.body.scrollHeight * 0.75 && !scrollFired) {
scrollFired = true;
fbq('trackCustom', 'ScrollDepth75', { page: window.location.pathname });
}
});
Custom events can be used for campaign optimisation only if they are also configured as Custom Conversions in Events Manager. To convert a custom event into a trackable conversion: Events Manager → Custom Conversions → Create Custom Conversion → select your custom event.
Google Tag Manager Setup
GTM is the recommended method for implementing the Meta Pixel on most websites — it avoids modifying site code directly and allows event management without developer involvement for subsequent changes.
GTM implementation steps
- In GTM, create a new Tag → Tag Type: Custom HTML
- Paste the full Meta Pixel base code (with your Pixel ID) into the HTML field
- Trigger: All Pages (fires the PageView automatically on every page)
- Save and name the tag (e.g. "Meta Pixel — Base Code")
Adding standard events via GTM
For each conversion event, create a separate GTM tag:
- New Tag → Custom HTML
- HTML:
<script>fbq('track', 'Purchase', {value: {{DL - ecommerce.purchase.totalPrice}}, currency: 'GBP'});</script> - Trigger: the specific page or data layer event where this conversion occurs (e.g. Order Confirmation page URL, or a GTM trigger for the checkout_complete data layer event)
Meta also offers a native GTM template in the Community Template Gallery — search "Facebook Pixel" in GTM's Template Gallery for a structured setup that reduces manual code entry.
Verification
Meta Pixel Helper (Chrome extension)
The Meta Pixel Helper Chrome extension (available in the Chrome Web Store) shows which pixel events fire on any page you visit. Install it, then visit your website and complete a test conversion. The extension shows: which pixel IDs are firing, which events fired, the event parameters sent, and any errors.
Events Manager Test Events
In Events Manager → your pixel → Test Events tab: enter your website URL. Meta opens the site in a frame and displays all events firing in real time. More detailed than Pixel Helper — shows full parameter values, event timing, and whether events are being deduplicated with CAPI.
What to verify before campaign launch
- PageView fires on every page (check 3–5 different pages)
- Purchase event fires on the order confirmation page with correct value and currency
- Purchase event does NOT fire on any other page
- event_id parameter matches between pixel and CAPI (for deduplication)
- No duplicate event firing (e.g. Purchase firing twice on one order)
Pixel Health Monitoring
Events Manager provides a pixel health overview showing event volume trends, event match quality, and any detected issues. Key health indicators to monitor:
- Event volume. If Purchase event volume drops suddenly, it may indicate a pixel break from a website update. Monitor weekly — sudden drops need immediate investigation.
- Event Match Quality score. A 0–10 score showing how well Meta can match your pixel events to Meta user accounts. Improve by enabling Advanced Matching (passing hashed email/phone at event time) and implementing CAPI alongside the pixel.
- Duplicate events. If the same event appears to be firing multiple times per conversion, check for double-installed base code or missing event_id deduplication with CAPI.
- Missing required parameters. Events Manager flags events missing recommended parameters (e.g. Purchase without value/currency) — add them to improve catalogue and dynamic ad functionality.
Authentic Sources
Complete Meta Pixel technical documentation including base code, events, and parameters.
Full reference for all 17 standard events and their parameters.
Installing and using the Pixel Helper Chrome extension.