The use of Meta server-side tracking (Meta Conversion API) is becoming increasingly popular as it prevents pixel-blocking by ITPs and AdBlockers and increases the lifespan of Facebook cookies. When you measure Meta data both client side and server side, some events are measured twice. Meta wants to distinguish between events coming from the pixel and the conversion API. Meta has therefore come up with a solution to take out the duplicates, namely using a “Unique Event ID. In this blog, we explain how this ID works and how you can use it to apply event deduplication to META. For this, you need to set up event deduplication both client side and server side.
Not all set yet? Check out the entire Facebook Server Side Tracking setup.
Note: This blog is only about META. Deduplication is not required for most other tags unless otherwise noted.
Table of Contents
Client side event deduplication setup
Step 1: Create variable
First, we must set the necessary variable before we can begin further configuration. Within the webcontainer (client-side) , go to “Variables” and click “New.
Step 2: Set variable
Click on ‘Variable Configuration’ and then choose ‘Discover more variable types in the template gallery….’. Here, search for unique event id and add the ‘Unique Event ID’ variable to the workspace. Then save the variable.
Step 3: Setting Meta pixels
Go to ‘Tags’ within the web container and click on the Facebook Pixel.
Note: There are multiple ways to install the Facebook pixel through GTM. The most common are by a custom HTML script (which META provides when creating a new pixel), or a template from the template gallery.
Template
In this example, we are using a template. Due to the transition from UA to GA4, it is necessary to create multiple tags from this template. One per event you want to measure. Do you also have multiple tags from the Facebook Pixel? Then add the event_id to each tag, as described below.
Click on the pencil and go to “More settings. Click the + sign here and select the Unique Event ID varialbe just created. Then save the tag by clicking Save .
Custom HTML script
Are you using a custom HTML script or multiple HTML scripts per event? Then you need to add an event ID parameter to the Facebook event you want to measure. Add the following code after the event you want to track:
fbq(‘track’, ‘EVENTNAME’, {},{eventID: ‘{{Facebook event ID}}’});
Example change in code PageView:
fbq(‘track’,PageView’); -> fbq(‘track’,PageView’, {},{eventID: ‘{{Facebook event ID}}’});
Then click on “Save.
Step 4: GA4 Google Tag setup
Go to Tags → Google Tag. Then, under Configuration parameter, add the following parameter: event_id – {{Unique Event ID}}. Then Save the tag and Facebook is deduplicated to the Client Side.
Then repeat this for all GA4 Event Tags. When all the tags are setup press ‘Submit’ at the top right to put the container live
Setting up Server side event deduplication
Step 1: Create variable
Now that the event deduplication is set up side we will now set it up server side. Go to the server container and click on “Variables. Then click on “New.
Click on the pencil. Then click on “event data” and select it. Then under key path enter event_id. Give the variable a name, for example: Facebook Event ID. Then save the variable. Don’t see event data listed? Then you are probably working in the client-side container instead of the server container server container.
Step 2: selecting Facebook conversion API
Go inside the server container Go to “Tags” and select the “Facebook Conversion API. Not created a Facebook Conversion API yet? Then go to this blog.
Step 3: Setting up Facebook conversion API
Click on the pencil and go to ‘server event data to override’. Then click on “add property.
Select “Event ID” under “Property Name. Under ‘Property Value’, click the plus sign and select ‘Facebook Event ID’. Click ‘Save’ to save the tag.
Now put the server container live et voilla: your first Conversion API implementation! You have now gone through the entire Meta implementation sequence, nice going! From now on, all Meta events are measured and deduplicated both client side and server side.
Facebook Event Deduplication Validate in Business Manager
You can validate Facebook Event Deduplication in Facebook’s Business Manager. Go to your Pixel –> Select Event –> View Details. Here you can see how much % of the event is deduplicated. We have added the Event ID, which is why we are looking at Event ID in Deduplication Keys. We see that from the Facebook Pixel 95.35% is deduplicated and from the Conversion API 100%.
About the author
Ate Keurentjes
Server Side Tracking Specialist at TAGGRS
Ate Keurentjes is a Server Side Tracking specialist at TAGGRS. He has experience with various Google Tag Manager concepts. Keurentjes has been editing and writing about the latest developments and trends in data collection / Server side tracking since 2023.