How to set up the Meta Pixel correctly and check it works

The Meta Pixel is a small piece of code on your site that tells Meta what someone did after an ad: looked at a product, added it to the cart, bought it. In Events Manager you create a data source for your website, add the code with your platform’s integration or by hand, and check it with the Test events tool. A purchase has to send its value and currency, and it has to fire once per order. If you also send events from your server with the Conversions API, both have to send the same event ID, or purchases will be counted twice.

Oskars Cirsis, founder of AdsWork · Updated · 6 min read

A painting after Vermeer’s “The Astronomer”: a scholar studies one tiny pixel on a laptop screen through a jeweller’s loupe

What the pixel does, and who should own it

Without a pixel Meta sees only clicks. With one, it sees what happens after the click and can show the ad to the people most likely to buy. Meta now also calls it a dataset, but it’s the same thing. One pixel can serve several ad accounts, but one website needs only one pixel; several pixels on one site usually mean double counting.

How the pixel, the business account and the ad account fit together

Meta business account

  • Pixel, or dataset
    • Code on your site
    • Events: view, cart, purchase
    • Connected ad accounts
  • Ad account
    • Campaigns
    • Optimises on the pixel’s events

Five steps to set it up

  1. Open Events Manager. In Meta’s business tools open Events Manager and choose “Connect data”, then “Web”.
  2. Name the pixel and enter your site address. One pixel per website; put the business or site name in the name.
  3. Choose how to add the code. If your site runs on Shopify, WooCommerce, WordPress, Wix or similar, use its integration. Otherwise the code goes into the page’s <head> or through Google Tag Manager.
  4. Connect the pixel to your ad account. In Business settings under Datasets and pixels, open the pixel, “Connected assets”, and add your ad account.
  5. Check with Test events. Open your site, add a product to the cart or make a purchase, and see whether the events show up in Events Manager.

Where the law requires it, load the pixel only after the visitor has agreed to cookies. Most cookie tools and platform integrations can do this. Then check that the pixel really loads once cookies are accepted, because otherwise no purchases will be tracked at all.

Which events to send

The main standard events for a shop or a service
EventWhen to send itWhat must go with it
PageViewOn every page load (the base code does this itself)Nothing
ViewContentWhen a product or service page opensA product ID is recommended
AddToCartWhen a product goes into the cartValue and currency recommended
InitiateCheckoutWhen checkout startsValue and currency recommended
PurchaseOnce per order, on the confirmation pageValue and currency required
LeadWhen an enquiry form is sentNothing required

The pixel and the Conversions API together

Browsers and ad blockers stop some pixel events. That’s why Meta recommends sending the same events from your server too, with the Conversions API. On many platforms it’s one switch in the integration. What matters is that one event has the same name and the same event ID (event_id) on both paths; for purchases Meta can also use the order number.

How to check it works

  • Test events in Events Manager. Open your site through this tool and do things: events should appear within seconds.
  • Meta Pixel Helper in Chrome. A free extension that shows which events fire on a page and whether there are errors.
  • One purchase is one Purchase. Reloading the confirmation page mustn’t send another purchase.
  • The numbers match the shop. After a week, compare Meta’s purchase count with your shop’s orders; a small gap is normal, double is not.

The most common mistakes

  • Two pixels or two integrations at once. Then every event fires twice. Keep one.
  • Purchase on every page. A purchase is counted when someone merely opens a page. Send it only after payment.
  • A purchase without a value, or in the wrong currency. Meta can’t tell which ads bring money.
  • The pixel belongs to an agency. When the work ends, the data leaves with it. The pixel should be in your business account.
  • The pixel isn’t connected to the ad account. Then you can’t choose it as a goal in a campaign.

Verifying your domain in Business settings is no longer required for measurement, but Meta still recommends it so others can’t edit links to your site. How to get the rest of your site ready for ads is in the guide check your website before paying for ads.

Astronomer, the AdsWork helper who reads results: a painted man in a dark cloak following numbers on a tablet with his finger
The AdsWork tracking check on the results page shows what Meta has received from your site in the last 28 days. If purchases are missing there, or there are too many, these steps help find the reason.

Frequently asked questions

Is the Meta Pixel free?

Yes. The pixel, Events Manager and the Conversions API are free. You pay only for ads. If a developer sets up the Conversions API or you use a paid plugin, you pay for their work or the plugin, not Meta.

Do I need the Conversions API if I already have the pixel?

It’s recommended. Browsers and blockers stop some pixel events, and the server sends them anyway. What matters is a shared event ID, or purchases will be counted twice.

Why does Meta show more purchases than my shop?

Most often because a purchase fires twice: from two pixels, two integrations, a reloaded confirmation page, or the pixel and the server without a shared event ID. Check with Test events and Meta Pixel Helper.

Do I have to verify my domain?

Not for measurement any more, but Meta recommends it. A verified domain lets your business account control links to your site and is needed for some other features.