Built for Shopify & WooCommerce · Tracking checked every 30 minutes.

How to set up the Facebook Conversion API with Google Tag Manager (with deduplication)

Abir Molla
Abir MollaNov 20, 2026 · 10 min read
How to set up the Facebook Conversion API with Google Tag Manager (with deduplication)Video · 20:10 · plays from YouTube

To set up the Facebook Conversion API (Meta calls it the Conversions API) with Google Tag Manager, you run two containers: a web container that fires the Meta Pixel in the browser, and a server container that sends the same events to Meta from your own tracking server. Give every event the same event ID on both sides, and Meta keeps one copy of each. You get the sales the browser pixel misses, without double counting.

The video above walks through the whole setup on a store in about 20 minutes. This post is the written version: the steps in order, what to check, and the mistakes I see most.

Why the pixel alone isn't enough

The Meta Pixel runs in your visitor's browser. Ad blockers, browser privacy rules and iOS settings stop some of those events from reaching Meta, so Meta sees fewer sales than you made and has less to optimise your ads with.

The Conversions API sends the same events from a server instead. A server event isn't affected by what the browser blocks. Meta recommends running both: the pixel and the Conversions API together, sharing an event ID so Meta can tell they're the same event (Meta, handling duplicate pixel and Conversions API events).

What you need

  • Two Google Tag Manager containers: a Web container on your site and a Server container.
  • A place to run the server container. In the video I use Stape. Google Cloud works too. Stape is easier to manage if you're not a developer.
  • A subdomain of your store's domain for the server, such as data.yourstore.com, and access to your DNS settings.
  • Your Meta Pixel ID and a Conversions API access token. This guide shows where both are in Events Manager.
  • A data layer that gives GTM the product, order and customer details on each event.

The events in the video are the ones most stores need: PageView, ViewContent, AddToCart, InitiateCheckout and Purchase. Your list may differ.

Step 1: set up the Meta Pixel with an event ID

In your web container, create a Meta Pixel tag for each event. For every tag:

  • Enter your Pixel ID.
  • Fill in the Event ID, from a variable that makes one unique ID per event. This is the field that makes deduplication work. Leave it empty and Meta can't pair the browser event with the server one.
  • Add the event's parameters from the data layer.

The parameters I send:

  • ViewContent, AddToCart: content_ids, content_name, content_type, value, currency. Use content_type product for a single product, or product_group if your products have variants such as size or colour.
  • InitiateCheckout: the same, plus num_items.
  • Purchase: the same, plus order_id set to the real order ID.
  • External ID on every event. It's your own ID for the customer. It helps Meta match events to people, which raises Event Match Quality and helps retargeting.

Trigger each tag on its own data layer event, and PageView on all pages.

Step 2: create the server and your tracking subdomain

In your server container, go to Admin → Container settings and copy the Container Config. Paste it into your hosting service (Stape, in the video), give the container a name, and pick the server location closest to your customers.

Then connect your subdomain. Your hosting service gives you a DNS record, usually a CNAME. Add it where your domain's DNS is managed: Cloudflare, Namecheap, Hostinger, GoDaddy or wherever yours lives. The steps are the same everywhere. DNS can take a while to update. In my experience verification can take up to 72 hours, though it's often much faster.

Once it's verified, add the subdomain as the Server container URL in the container settings and save.

Running the server on your own subdomain makes it first-party. The browser talks to data.yourstore.com, part of your own site, instead of a third-party tracking domain, so fewer requests get blocked.

Step 3: send the events to your server

Back in the web container, add a Google tag with a GA4 measurement ID and set the server_container_url to your subdomain. Fire it on Initialization. This is the route your events take to the server: the server container's GA4 client receives them.

Then add a GA4 event tag for each event, with these parameters:

  • event_id: the same variable you used in the pixel tag. Same event, same ID on both sides.
  • event_time.
  • fbp and fbc: Meta's browser and click cookies. They help Meta connect the event to the ad click.
  • The same product parameters as the pixel tag.
  • On Purchase, the customer's details too: email, phone, name and address, for matching.

Use the same triggers as the pixel tags.

Step 4: add the Conversions API tag on the server

In the server container, add a Facebook Conversions API tag. Enter your Pixel ID, your access token, and for now a Test event code from Events Manager → Test events. Trigger it on the events that come in through the GA4 client, then save and publish the server container.

Meta asks for customer details such as email and phone to be hashed with SHA-256 before they're sent (Meta, customer information parameters). The Conversions API tag in the video does that for you. If you use a different tag, check that it does.

Last, add your hosting service's loader script to your site's <head> so the browser loads tracking from your own subdomain. On WooCommerce and most sites, that's your theme's header. On Shopify, the checkout and thank-you pages don't run your theme's code, so purchase events have to come from a custom pixel under Settings → Customer events. Check that your data layer sends the purchase from there.

Step 5: test it and check deduplication

Turn on Preview in both containers. In the server preview, you should see the requests come in from your subdomain and the Conversions API tag fire.

Browse the site, add something to the cart and place a test order. Then open Events Manager:

  1. Test events shows each event arriving from the browser and from the server. When both carry the same event ID, Meta marks them as deduplicated.
  2. Open the Purchase event and check the details Meta received: value, currency, content IDs, number of items, order ID, and customer details such as email, country and external ID.
  3. In the GTM previews, compare the event ID in the web pixel tag with the event_id the server received. They should be identical.

Meta pairs a browser event and a server event when they have the same event name and the same event ID, and arrive within 48 hours of each other (Meta). For more on reading the numbers, see Meta CAPI deduplication and event_id.

Step 6: publish

When everything checks out, clear the Test event code from the Conversions API tag. Meta says the test code is for testing only (Meta, using the Conversions API). Then submit and publish both containers.

Give it a day of normal traffic, then look at the Event deduplication tab on the Purchase event in Events Manager. One test order doesn't tell you much.

Common mistakes

Different event IDs on each side. If the pixel and the server use different variables, or one side has none, Meta counts both copies and your purchases look doubled.

Another app still sends purchases. Meta's Facebook & Instagram app on Shopify, a pixel plugin, or pixel code left in your theme sends its own copy of each purchase with its own ID. Meta can't pair it with yours. Keep one source of Meta purchases.

Contents are missing on the server. In the video I forgot to send the items array at first, so the server events had no contents. Add the items to the GA4 event tags and check again.

The Test event code was left on. Remove it before you publish.

Customer data sent unhashed, or not at all. Email and phone raise Event Match Quality. Send them on Purchase, and make sure they're hashed before they leave your server. Our free hash generator shows what a correctly hashed email looks like.

Questions people ask

Do I still need the Meta Pixel if I use the Conversions API?

Yes. Meta recommends running both, with deduplication. The pixel catches browser-only signals; the server catches what the browser drops.

Is Stape required?

No. Stape is a hosting service for server-side Google Tag Manager. You can run the server container on Google Cloud or another host. I use Stape in the video because it's simpler to set up and manage.

Why use a subdomain of my own site?

Requests to your own domain are first-party, so browsers and ad blockers are less likely to block them.

How long until I see server events in Events Manager?

Test events shows them within seconds. On the Overview, new events can take around 20 minutes to appear. Judge deduplication after a full day of traffic.

Does this work on WooCommerce and Shopify?

Yes. The containers and tags are the same. What changes is where your data layer and loader script go, and on Shopify, that purchases come from a custom pixel.

Where KiteTrack fits

This is the setup KiteTrack builds and runs for you. KiteTrack sends your purchases to Meta from your own tracking server on your subdomain, next to the pixel, with one event ID so each sale counts once. It also checks your tracking every 30 minutes, so a broken event becomes an alert instead of a lost week. See how it works for Shopify and for WooCommerce.

Not sure whether Meta is getting all your sales? Start with the free Tracking Check. It looks at your site in about two minutes, no signup. If you'd rather talk it through, book a call with me.

Sources

Get tracking tips by email

Short, practical fixes for Meta, Google Ads and GA4, from Abir.

You’re in. First tip lands soon.

Abir Molla
Written by Abir Molla

Tracking specialist. He builds and runs KiteTrack, and explains tracking on YouTube.

Keep reading

Let your ads see every sale.

30-day money-back guarantee · free migration · cancel any time