taggrs-logo

How do you set up Facebook Event Deduplication?

facebook-event-deduplication-set-up

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.

How-do-you-set-up-Event-Deduplication-on-Meta

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.

google-tag-manager-werkruimte-client-side-variables

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.

create-variabele-google-tag-manager
unique-event-id-google-tag-manager

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.

google-tag-manager-workspace-tags-client-side

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 .

Facebook pixel - page_view - Unique event ID - {{Unique Event ID}}.

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.

tag-configuration-custom-html-google-tag-manager

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.

google tag-ga4-configuration-event-deduplication

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

tags-werkruimte-google-tag-manager

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.

choosing-container
workspace-variables-google-tag-manager

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.

gtm-variable-setting

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.

tags-werkruimte-google-tag-manager

Step 3: Setting up Facebook conversion API

Click on the pencil and go to ‘server event data to override’. Then click on “add property.

fb-conversion-api-settings-google-tag-manager

Select “Event ID” under “Property Name. Under ‘Property Value’, click the plus sign and select ‘Facebook Event ID’. Click ‘Save’ to save the tag.

facebook-conversion-api-instellingen-tag-google-tag-manager

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%.

validate-facebook-event-deuplication-business-manager

About the author

Ate Keurentjes

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.

Ready for the next level?

Start with Server Side Tracking and generate more revenue and conversions in a world without third-party cookies.