Tracking

Meta Conversions API with Google Tag Manager: setup

Set up the Meta Conversions API with server-side Google Tag Manager: prerequisites, steps, deduplication, testing and where the GTM route falls short.

·6 min read·By the ROASaurus team

Key takeaways
  • Server-side Google Tag Manager receives events from your web container and forwards them to the Meta Conversions API from a server you control.
  • You need Events Manager access, a GTM web container, a server container on a tagging server (often on your own subdomain) and a working GA4 setup.
  • The browser pixel and the server tag must share one event_id, or Meta counts purchases twice.
  • Most GTM setups still start in the browser: if the purchase event never fires on the thank-you page, the server never sees it.
  • Sending purchases from the store's order data closes that last gap, and it can feed your server container too.

You can send events to the Meta Conversions API through Google Tag Manager by adding a server container: your website sends events to a tagging server you control, and a Meta tag in that server container forwards them to Meta. It works, and it gives you control over the data. But the purchase usually still starts as a browser event, so a GTM setup inherits part of the problem it is meant to solve.

This guide explains what the Conversions API does, why GTM is a popular way to run it, what you need before you start, the setup step by step, the pitfalls, and when sending purchases from your store's backend is the better route.

What the Conversions API does, in plain words

With only the Meta pixel, a purchase has to be reported by the shopper's browser. If the browser blocks the request, the tab closes early or the thank-you page never loads, Meta never hears about the sale. The Conversions API lets a server send the same event instead, so the browser is no longer the only messenger.

The important word is "send". The Conversions API does not discover purchases on its own: it only delivers what its source gives it. A server that forwards browser events is exactly as complete as those browser events. Our Conversions API guide covers the event format and parameters in depth.

Why teams use Google Tag Manager for the Conversions API

  • One place for all tags. Marketing teams already manage GA4, Google Ads and Meta tags in GTM, without changing theme code for every change.
  • A server you control. Server-side GTM runs in a cloud project (Google Cloud by default) and can be reached on your own subdomain, so requests look first-party to the browser.
  • One stream, many destinations. A single event from the website can be forwarded to GA4, Meta and other platforms by tags in the server container.
  • Data control. You can remove or transform fields in the server container before anything reaches a vendor.
BrowserGTM web container fires a GA4 event, e.g. purchase
Tagging serverServer container on gtm.yourstore.com receives it
Meta tagMaps the event to a Conversions API Purchase
MetaDeduplicates against the pixel with event_id
The usual GTM route: the browser still starts the event, the server delivers it.

What you need before you start

WhatWhy
Admin access to your Meta business portfolio and Events ManagerTo pick the dataset (pixel) and create an access token
Admin access to Google Tag ManagerTo create and publish a web and a server container
A GA4 property with ecommerce eventsThe GTM route usually uses GA4 events (purchase, add_to_cart, begin_checkout) as the source
A server container with a tagging server URLHosted on Google Cloud or another host, ideally on a subdomain of your store
A way to read the order and customer data on the thank-you pageValue, currency, order id and contact details for matching
A consent setup that GTM can readSo tags only fire when the visitor allowed it, where the law requires that
Without these pieces the setup will run, but not reliably.

Step by step: Conversions API through server-side GTM

  1. Check your Meta dataset

    In Events Manager, find the dataset (formerly called a pixel) that receives your website events, or create one. Browser and server events must go to the same dataset.

  2. Create the server container

    In Tag Manager, create a container of the type Server and deploy it. Map a subdomain such as gtm.yourstore.com to it, so the browser sends events to your own domain.

  3. Point the web container at the server

    In the GA4 configuration of your web container, set the server container URL as the place to send events. Check that purchase, add_to_cart and begin_checkout fire with value, currency and item data.

  4. Add the Meta tag to the server container

    Use Events Manager's guided Google Tag Manager setup under partner integrations, or add Meta's Conversions API tag template from the community gallery yourself. Enter the dataset id and an access token, and map GA4 event names to Meta events (purchase to Purchase).

  5. Pass customer information

    Send email and phone (the tag hashes them), the client IP address and user agent the server receives, and the _fbp and _fbc cookies. Without these, Meta matches few events.

  6. Share one event id

    Generate an id once in the web container, send it as eventID with the pixel and as event_id with the server event. Build it from the order id for purchases.

  7. Test and publish

    Use GTM preview mode on both containers, then the Test events tab in Events Manager. A good purchase shows as received from browser and server, deduplicated, with match keys present.

Common pitfalls with GTM-based setups

PitfallWhat happensFix
The purchase only fires in the browserA blocked or skipped thank-you page means no GA4 event, so no server event eitherAdd a backend source for purchases
Different event ids on pixel and serverMeta counts purchases twice, or cannot deduplicateOne id, created once, used by both tags
Missing or badly hashed contact dataLow Event Match Quality, weak optimizationPass email and phone from the order, normalized
Server IP and user agent sent instead of the shopper'sMatching gets worse, not betterForward the client values the container received
A second CAPI sender for the same pixelAn app or the shop's Meta channel sends the same purchaseKeep one server sender per dataset
Consent ignored in the server containerEvents go out for visitors who declinedPass the consent state with each event and respect it in the tags
Each pitfall is silent: nothing breaks visibly, the numbers are just wrong.

Why GTM alone is not ideal for a webshop

A server container makes delivery more reliable, but the source of the purchase is still the browser in most setups. The store, on the other hand, knows about every paid order, including the ones where the thank-you page never loaded, the shopper paid with a wallet in another window, or a script blocker stopped GTM entirely.

GTM-triggered Conversions API
  • Purchase starts as a browser event
  • Misses orders where the browser event never fires
  • You host, update and monitor the containers
  • Full control over every field
Backend-triggered Conversions API
  • Purchase starts from the paid order
  • Every paid order is a candidate to send
  • Click ids still need a first-party script during the visit
  • Works next to GTM rather than instead of it
The two are not exclusive: a backend source can feed the same server container.

The backend route still needs the browser for one thing: the identifiers from the visit (fbclid, _fbp, a visitor id). A first-party script saves them during the visit and attaches them to the cart, so they arrive with the order. The server-side tracking explainer walks through that data path.

The backend route in ROASaurus

ROASaurus sends Purchase to the Meta Conversions API from your store's order data, with the click ids and visitor id saved during the visit and hashed customer details from the order. Browser and server copies share the event id order- plus the order id. If you already run a server container, ROASaurus can also forward order events to it as a Server-side GTM destination (GA4 Measurement Protocol format), so your own tags receive purchases the browser missed. It forwards only events with confirmed marketing consent, because the container's tags can send data anywhere. If you keep GTM for Meta as well, turn off one of the two Meta senders.

The ROASaurus Mac app showing Tracking health: a card per destination, Purchase accuracy per day for Meta, GA4 and TikTok, and accuracy per payment method. Fictional demo store, simulated data.
The ROASaurus iPhone app showing Tracking health: a card per destination, Purchase accuracy per day for Meta, GA4 and TikTok, and accuracy per payment method. Fictional demo store, simulated data.
Data quality › Overview in the public demo (ROASaurus Demo Store, a fictional store): expected and accepted purchases per destination, with match keys and EMQ for Meta.

After the switch, Data quality › Overview shows per destination how many purchases were expected and how many the platform accepted, and Data quality › Deliveries shows every event with its status and the platform's response.

Next step

Sources

  1. Google Tag Manager: An introduction to server-side tagging
  2. Google Tag Manager: Send data to server-side Tag Manager
  3. Meta for Developers: Handling Duplicate Pixel and Conversions API Events
  4. Meta: Conversions API tag for server-side Google Tag Manager (GitHub)

In ROASaurus

Keep reading

TrackingServer-side GTM on Google Cloud: when a store needs itWhat running your own server-side Google Tag Manager container on Google Cloud involves, when a store needs it, and when a managed setup is enough.TrackingWhat is server-side tracking? What it changes for a storeServer-side tracking sends purchases from your order data to ad platforms. See how it works, what it sends, how deduplication works and what it cannot fix.TrackingMeta Conversions API (CAPI) explained: a practical guideWhat the Meta Conversions API is, why it exists, how it works next to the pixel with one event_id, which parameters raise match quality and how to test it.

FAQ

Questions, answered

More answers in the FAQ and the help center.

Do I need GA4 to send the Meta Conversions API through GTM?

For the usual setup, yes. The web container sends GA4 events to the server container, and the Meta tag in the server container turns them into Conversions API events. You can also send custom event data to the server container without GA4, but that takes more work.

Is server-side GTM free?

Tag Manager itself is free, but the server container runs on cloud servers that you pay for. Production setups usually run more than one instance, so budget for hosting and maintenance.

How do I avoid double counting with GTM and the pixel?

Send the same event_id with the browser pixel event and with the server event, and use the same event name. Meta then keeps one of the two copies when they arrive within 48 hours of each other.

How do I check that it works?

Use preview mode in both containers, then the Test events tab in Meta Events Manager. A test purchase should arrive from browser and server with one event id, the right value and currency, and customer information on the server copy.

Can GTM recover purchases the browser missed?

Not when the purchase event starts in the browser. If the browser event never fires, the server container receives nothing. A backend source, such as the store's order data, is needed for those orders.

Every sale, traced to the ad that earned it

Server-side tracking, profit and lifetime value in one app. Free plan, no credit card.