Webhook deduplication
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).
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:
- 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
Thank you!