Meta Ads

Meta Pixel

Also called Facebook pixel, Meta pixel code

A piece of code from Meta, placed on your website, that reports visits and actions back to Meta for measurement, optimisation and audiences.

Quick facts: Meta Pixel

Category
Meta Ads
Also called
Facebook pixel, Meta pixel code
Level
Intermediate
Affects
Conversion tracking, campaign optimisation, retargeting audiences, lookalike audiences, consent compliance
Where to see it
Events Manager, Meta Pixel Helper browser extension, Test Events, Google Tag Manager, your consent management platform
In this article4
  1. How the Meta Pixel works
  2. Why it matters
  3. Common mistakes
  4. How to act on it

The Meta Pixel is a small piece of JavaScript code from Meta that you add to your website so it can report what visitors do, such as viewing a page, adding to basket, submitting an enquiry or buying, back to Meta. Meta uses those reports to measure ad results, optimise delivery towards people likely to act, and build audiences for retargeting.

How the Meta Pixel works

When the pixel loads in a visitor’s browser, it records a PageView and can send further events when something happens. Meta defines a list of standard events, such as Lead, AddToCart, InitiateCheckout and Purchase, and you can add custom events of your own. Each event can carry details such as the order value and currency.

To link visits to people, the pixel sets a first-party cookie called _fbp and, when someone arrives from an ad, stores the click identifier in another called _fbc. The _fbp and _fbc entry explains both. Events arrive in a dataset you can inspect in Events Manager, where Meta matches them to its users.

Browsers, ad blockers and refused consent all stop some events from reaching Meta, so most advertisers now pair the pixel with the Conversions API, which sends the same events from your server. Both carry a shared event ID so Meta counts each action once.

Why it matters

Without the pixel or an equivalent, Meta cannot see enquiries or sales on your website. It will optimise for clicks instead, and clicks are cheap for a reason. Retargeting audiences and lookalikes built from your customers also depend on it.

For a UK site, the pixel is non-essential tracking. Under PECR, storing or reading information on a visitor’s device needs their prior consent unless it is strictly necessary for a service they asked for, and the ICO has made clear that advertising cookies are not. UK GDPR then applies to the personal data the pixel sends. In practice the pixel must not load, or must run in a revoked consent state, until the visitor accepts marketing cookies in your cookie banner. The Conversions API is not a way round this: server-side sending still needs a lawful basis and must respect the same choice.

Common mistakes

  • Pasting the pixel into the site header so it fires before the banner is answered.
  • Installing it twice, through the theme and a plugin, so every event is counted double.
  • Firing the Lead event when the form page loads rather than when the form is submitted.
  • Sending sensitive information in URLs or parameters, such as a clinic page address naming a condition. Meta’s own terms forbid it and so does good practice.
  • Setting up a pixel inside an agency’s business portfolio, so the business loses its data when the agency relationship ends.

How to act on it

Create the pixel (now part of a dataset) in your own business portfolio. Install it through Google Tag Manager or a well-maintained plugin, gated by your consent management platform so it fires only after consent to marketing cookies. Add the events that match your goals, add the Conversions API with deduplication, then test each event with Test Events and the Pixel Helper extension, including with consent refused.

Expect Meta to report fewer conversions than actually happened when many visitors decline cookies; that is the price of doing it lawfully. Setting up tracking this way is the first step of my Facebook ads management work, because every later decision depends on it.

Do and do not

Do

  • Load the pixel only after the visitor consents to marketing cookies
  • Pair the pixel with the Conversions API and deduplicate the events
  • Test every event in Events Manager after any change to the site

Do not

  • Fire the pixel on page load before the cookie banner has been answered
  • Send health, financial or other sensitive details in URLs or event parameters
  • Install the pixel twice through the theme and a plugin

Questions people ask about this

Do I need cookie consent for the Meta Pixel in the UK?

Yes. The pixel stores and reads cookies for advertising, which PECR treats as non-essential, so you need the visitor's prior consent. Configure your banner so the pixel stays off, or in a revoked consent state, until marketing cookies are accepted.

Is the Meta Pixel still needed if I use the Conversions API?

For most websites, yes. The two work best together: the pixel captures browser details that help Meta match visitors, and the Conversions API fills gaps from blocked browsers. Send both with a shared event ID so Meta removes duplicates.

How do I check my Meta Pixel is working?

Open Events Manager, choose your dataset and use Test Events while you browse your site and complete a test action. The Meta Pixel Helper browser extension also shows which events fire on each page. Repeat the test with cookies refused to confirm nothing fires before consent. My guide on checking your conversion tracking works walks through the full test.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.