How do you set up Meta Event Deduplication?
Using Meta server-side tracking(Meta Conversions 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 remove 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 up 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 need to set up the required variable before we can begin further configuration. Within the web container (client side) , go to 'Variables' and click on '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 through 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'. Here, click on the + sign and select the Unique Event ID varialbe you 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 on the Client Side.
Then repeat this for all GA4 Event Tags. When all tags are set 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 client-side is set up 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 icon. Then click on 'event data' and select it. Next, 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? Then you're probably working in the client-side container instead of the server container.
Step 2: selecting Facebook conversion API
Within 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'.
At 'Property Name', select 'Event ID' . At 'Property Value', click on 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 completed 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 Validation 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, so we look at Event ID in Deduplication Keys. We see that from the Facebook Pixel 95.35% is deduplicated and from the Conversion API 100%.