Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Setting up client-side Meta Ads tracking with deduplication

Setting up client- and server-side tagging for Meta Ads with event_id deduplication

Running both server-side and client-side tagging means Meta receives the same conversion twice: once from the browser and once from your server. Deduplication is what stops that from being counted twice. It works when both events carry the same event name and the same event_id. Meta then keeps one and discards the duplicate, preferring the server event, which is the more reliable of the two.

So the goal throughout this guide is that your Meta Pixel tag, your GA4 tag and your server-side Conversions API tag all describe the same interaction with the same event ID.

Before you start

Make sure you have:

Step 1: Add the tag template

  1. Open your GTM web container and go to Templates.

  2. Under Tag Templates, click Search Gallery.

  3. Search for the Meta Pixel tag template and add it to your workspace.

Step 2: Create a variable for your Pixel ID

  1. Go to Variables.

  2. Create a new User-Defined Variable and choose Constant as the variable type.

  3. Enter your Meta Pixel ID as the value and save the variable.

Using a constant variable rather than typing the ID into each tag means you only have one place to change it later.

Step 3: Create your Meta event tags

  1. Go to Tags and create a new tag. Select the Facebook Pixel template as the tag configuration.

  2. In the Meta Pixel ID field, select your Pixel ID variable.

  3. Under Event Name, indicate whether this is a standard or a custom event. Select a standard event from the dropdown menu, or type a custom event name into the input field.

  4. Expand More Settings. In the Event ID field, enter your Unique Event ID variable.

  5. As the trigger, select the same trigger you use for the GA4 event tag covering this interaction.

  6. Save the tag. And repeat for the other events and conversions you want to set up.

Step 4: Add the event_id to your GA4 events

Your GA4 event tags are what feed the server container, so the event ID has to travel with them. For every interaction you want to deduplicate, add your Unique Event ID variable as an event_id event parameter on the GA4 event tag that fires on that interaction.

Step 5: Test and Verify

Open Google Tag Manager's preview mode to check whether the event_id in the client-side Meta Event tag matches the server-side Facebook Conversion API tag. If this is not the case, the usual causes are:

  • The event names do not match. The Pixel sends one name and the server-side tag sends another.

  • The event IDs do not match, or the server-side tag receives no event ID at all.

  • The two tags fire on different triggers, so they never describe the same interaction.

Last updated

Was this helpful?