Articles on: Miscellaneous

Webhook deduplication

With increasing privacy regulations and stricter requirements for consent processing, such as GDPR and ePrivacy, it is becoming more challenging to get complete data insights. To collect first-party data, server-side tagging is the ideal tracking method. However, a Server-Side Tagging setup alone is not enough to gather the most accurate data. Together with advanced solutions like Webhooks, this can be achieved, as you may have read in our previous blog article.

What are Webhooks?



Conversion webhooks for eCommerce stores allow your CMS system to automatically send a message to other systems. In the case of webshops, a message can be sent from the backend of your shop to your server when an order is created. Sending these messages happens directly from system to system, enabling information to be exchanged directly and efficiently. Webhooks ensure, among other things, that you can also track purchases from cookie-rejecting visitors (although you will not be able to see the marketing and user information of those visitors in your marketing and analytics channels).

At AdPage, we have developed a feature that ensures a webhook is only sent if the GA4 purchase event has not been recorded. This is done by checking whether the transaction_id is already available in the GA4 purchase event data. If it is missing, the webhook is sent to complete the data. If the transaction_id is recognized, the webhook is blocked. This prevents duplicate measurements and ensures a complete view of your conversions.



How to Set Up Webhook Deduplication



Enable the option within your trytagging environment to check at the server level for received purchase events with a transaction_id to prevent duplicate conversions. You can do this in the Configuration settings.



To enable deduplication, you need to add a variable “X-Order-Exists” in your sGTM container. This variable is a Request Header variable with the value ‘X-Order-Exists’.



The Request Header checked by this variable contains information about receiving a purchase event with a transaction_id. If the transaction_id is not detected, the X-Order-Exists in the request header is set to “false.” If the transaction_id is detected, the X-Order-Exists in the request header is set to “true.”

So, if you want to forward the purchase event from the webhook, you need to add the condition that the X-Order-Exists variable is ‘false’ in the trigger for this tag. If AdPage has set up your implementation, you will use a total of 4 tags for Meta Ads and GA4. These are the four tags with their triggers:

- GA4 tag - When an event (except purchase as event name) is received on the GA4 client.
- GA4 purchase tag - When an /order_created request is received on the Data Client.
- Meta Ads tag - When an event (except purchase as event name) is received on the GA4 client.
- Meta Ads purchase tag - When an /order_create request is received on the Data Client.

This is how these tags should look in your Server container:

The two different GA4 tags and trigger on your sGTM container

The two types of Meta ads tags and triggers on your sGTM container

To make the webhook deduplication work for both platforms, adjust the triggers as follows:

- In the GA4 trigger, make sure to remove the ‘Event Name does not equal Purchase’ condition.
- In the Meta Ads trigger, make sure to remove the ‘Event Name does not equal Purchase’ condition.
- In the webhook trigger, ensure that the condition ‘X-Order-Exists equals false’ is added.

Updated on: 25/10/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!