Skip to content
Ads & Pixels

Ads and Pixels / Facebook pixel setup

Facebook pixel setup, done right the first time

The pixel, the Conversions API, and the one detail — a shared event ID — that keeps them from double-counting every sale.

One place. Every screen.Explore below
01 /

What you're actually setting up

This guide covers meta pixel setup and the Conversions API — sometimes searched as Facebook Conversion API or Facebook CAPI — together, since they're really one system with two delivery paths, not two separate things to configure. "Facebook pixel setup" used to mean pasting one script tag into a site's <head>. It still does that, but a pixel installed alone now misses a growing share of events — Safari's Intelligent Tracking Prevention, ad blockers, and iOS's App Tracking Transparency all block or shorten the browser-side pixel's view of what happened. The fix isn't a replacement; it's a second, parallel path. The Conversions API (CAPI) sends the same events from your server directly to Meta, where a browser-based ad blocker has no reach. A complete facebook pixel setup runs both together, so Meta sees an event from two directions. Left alone, that means every purchase gets counted twice. The piece that stops that — a shared event_id on both the browser and server copy of the same event — is the part most pixel tutorials skip, and it's the difference between numbers you can trust and numbers you can't. This guide covers both, in order, including that step.

02 /

Before you start a facebook pixel setup

Before any facebook pixel setup, you'll need: admin or advertiser access to a Meta Business Manager, admin access to a Facebook Page (a pixel is created under a Business Manager and attached to ad accounts, not a Page directly, but most setups also connect a Page), the ability to edit your website's code or access to a tag manager like Google Tag Manager, and — for the Conversions API step — either a Shopify/WooCommerce/other supported platform with a built-in CAPI integration, or a developer who can add a small amount of server-side code. If none of that applies yet, create a free Meta Business Manager account first at business.facebook.com; everything below assumes one already exists, whether you set up Meta pixel today for the first time or are fixing one installed years ago that's since drifted out of date.

03 /

Step 1 — Create the pixel in Events Manager

Open Meta Events Manager (business.facebook.com/events_manager2), choose Connect Data Sources, select Web, then Meta Pixel. Name it something you'll recognize later — the business or site name, not "test" or "pixel1." Meta generates a pixel ID (a string of numbers) the moment you create it; you'll need this ID in every step that follows, so copy it somewhere safe. This is also where the Meta Conversions API setup begins, since a pixel and its CAPI connection share the same pixel ID and the same event data — they're two delivery paths for the same underlying tracking, not two separate systems to configure from scratch.

04 /

Step 2 — Install the base pixel code

Meta gives you a snippet of JavaScript — the base code — to paste before the closing </head> tag on every page of your site. If you're using a tag manager (Google Tag Manager, Shopify's built-in pixel field, WordPress plugins like the official Meta Pixel plugin), use that integration instead of hand-editing template files; it's more reliable and survives theme updates. The base code alone fires a PageView event whenever someone loads a page — the minimum needed for the pixel to exist and start building an audience, but not enough on its own to measure the actions that actually matter to a campaign.

05 /

Step 3 — Add the events that matter

PageView tells you almost nothing about whether the ad worked. Add standard events for the actions tied to your goal: ViewContent (someone viewed a product or service page), AddToCart, InitiateCheckout, Lead (a form submit), CompleteRegistration, Purchase, Contact (a call or message start). Each one fires from the page where that action happens — a Purchase event on the order-confirmation page, a Lead event on the thank-you page after a form submits — and can carry parameters like value and currency so Meta's bidding can optimize toward revenue, not just event count. Pick the one or two events that match your actual goal and set those up first; a site tracking all nine standard events on day one usually means several are wired up wrong.

06 /

Step 4 — Set up the Conversions API

This is the server-side half. If your platform has a native integration — Shopify's, in particular, connects in a few clicks through Meta's own app in the Shopify App Store — use it before building anything custom; it already handles the shared event ID correctly. Outside a supported platform, CAPI setup means your server sending an HTTP POST to Meta's Graph API (/​{pixel-id}​/events) with an access token generated in Events Manager under Settings → Conversions API, for the same events you set up on the browser side in Step 3. This is the point where most small businesses bring in a developer — it's a real integration, not a copy-paste snippet — but it's also the single highest-leverage step in this guide, since it's what keeps your Meta reporting accurate once Safari or an ad blocker takes the browser pixel out of the picture.

07 /

Step 5 — Share one event ID between browser and server

Here's the step that prevents double-counting. When the same real-world event — a purchase, a lead — fires from both the browser pixel and the server-side Conversions API, generate one unique event_id value for that event and send it on both copies. Meta uses the pair of matching event_id and event_name (plus a short time window) to recognize the two events as one and deduplicate them automatically before they hit your reporting. Without this, a single $80 purchase can show up as two $80 purchases — the pixel's browser copy and CAPI's server copy each counted separately — quietly inflating every conversion number in the account. The event_id can be anything unique per event (a UUID, an order ID with a prefix); the only requirement is that the browser and server sends of the *same* real event use the *identical* value.

08 /

Step 6 — Test before you trust your facebook pixel setup

Events Manager's Test Events tool (under your pixel, in the left sidebar) shows events arriving in real time as you click through your own site — go through the actual purchase or lead flow yourself and confirm each event fires with the right name and parameters. For the Conversions API side, the same Test Events screen accepts a test event code you paste into your server requests temporarily, so you can confirm server-side events are reaching Meta correctly before removing the test code and going live. Do this before launching any campaign that optimizes toward these events — a campaign bidding on a Purchase event that never fires correctly will spend against the wrong signal for as long as it runs.

09 /

Step 7 — Confirm deduplication is actually working

In Events Manager, open the pixel's Overview or Diagnostics tab and look at the event source breakdown for your goal event (for example, Purchase). Meta shows how many came from the browser, how many from the server, and how many were matched and deduplicated. A healthy setup shows a meaningful "deduplicated" count once both sources are live — if that number stays at zero while both browser and server events are firing, the event_id values aren't matching between the two, and the fix is almost always a formatting mismatch (extra whitespace, a different casing, or the ID being regenerated separately on each side instead of shared from one source).

10 /

Common facebook pixel setup mistakes

The most common facebook pixel setup mistakes we see, in order of how often they show up: firing the base code twice (once hand-pasted, once through a plugin or tag manager, which doubles every PageView); tracking Purchase on the cart page instead of the confirmation page, which counts abandoned carts as sales; skipping the Conversions API entirely and wondering why reported conversions dropped after an iOS update; and generating a new event_id separately in the browser script and the server code instead of passing one value between them, which quietly breaks deduplication while looking, in Test Events, like everything is working.

11 /

Why this got harder since iOS 14.5

Apple's App Tracking Transparency framework, and the general trend across browsers toward blocking third-party tracking, means the browser-only pixel setup that worked in 2019 now misses a real and growing share of events — the exact share varies by traffic source and can't be honestly quoted as one number here. That's the whole reason the Conversions API exists as a second, server-side path: it isn't optional hardening for advanced accounts anymore, it's the baseline for facebook pixel setup done correctly in 2026.

A little more clarity

Frequently asked questions

Real answers before you make a decision.

Do I need both the pixel and the Conversions API, or just one?

Both, if you want a complete facebook pixel setup. The browser pixel alone now misses events blocked by Safari, ad blockers and tracking-prevention settings. The Conversions API alone misses the browser-side signals (like time on page) that help Meta's matching. Running both, with a shared event ID, gives the most complete and accurate picture.

Does a Shopify or WordPress facebook pixel setup work differently from a custom site?

The base pixel and CAPI work the same way everywhere, but the installation mechanics differ: Shopify and WordPress plugins handle a facebook pixel setup through their own app settings, while a custom site needs the code pasted or added through a tag manager by hand.

What is the Meta Conversions API in plain terms?

It's a way for your server — not just a visitor's browser — to tell Meta directly that an event happened (a purchase, a lead). It bypasses ad blockers and browser tracking limits because it never runs in the browser at all.

Will setting up the Conversions API fix all my tracking gaps?

It closes the biggest one — events an ad blocker or Safari would otherwise drop entirely — but it doesn't restore identity matching Apple's App Tracking Transparency removed at the device level. No setup fully replaces what a user declining tracking permission removes. If you only need to track Facebook pixel events for basic reporting, rather than to optimize a campaign, Facebook pixel tracking through the browser pixel alone is a lower-effort starting point — just expect it to undercount.

How long does facebook pixel setup take?

The base pixel and standard events usually take under an hour on a site with tag-manager access. The Conversions API step varies — a few minutes on Shopify with the official app, half a day or more for a custom server integration.

Can I use Google Tag Manager instead of pasting the code directly?

Yes, and it's usually the better choice — GTM makes it easier to fire events conditionally (only on the confirmation page, only after a specific button click) without editing your site's template code for every change.

How do I know if deduplication is actually working?

Check the event source breakdown in Events Manager's Diagnostics tab for your goal event. If it shows a nonzero "deduplicated" count once both the pixel and Conversions API are live, it's working. If that number stays at zero, the shared event ID isn't matching between the two sends.

Do I need to redo my facebook pixel setup every time Meta updates its API?

Not usually — Meta versions the Graph API and gives a deprecation window, so an existing facebook pixel setup keeps working until that window closes. Watch Events Manager for deprecation warnings rather than rebuilding on a schedule.

Is facebook pixel setup any different for a B2B lead-gen site versus ecommerce?

The mechanics are identical; only the events change. Ecommerce facebook pixel setup centers on Purchase and AddToCart; a lead-gen site centers on Lead and CompleteRegistration, fired on a form's thank-you step instead of a checkout confirmation.

Your next move

Skip the manual setup

Ads and Pixels installs and verifies the pixel, the Conversions API and the shared event ID automatically when you connect Meta — with a live test before anything goes live.