Webhook Deduplication

Tobias Pennings
October 22, 2024

Tracking and data collection are at the heart of any successful online marketing campaign. But with increasing privacy regulations and stricter consent processing requirements such as AVG and ePrivacy, it is becoming increasingly difficult to gain complete data insights. To collect first-party data, server-side tagging is the ideal tracking method. But just a Server-Side Tagging setup is not enough to collect the most accurate data. Together with advanced solutions such as Webhooks, this is possible as you have read in our previous blog article.

Previously, you could only use webhooks through AdPage to replace the GA4 purchase events you created client-side on your GTM web container. But thanks to a new feature, it is now possible to use the GA4 purchase events from client-side as leading events, and use the purchase events from webhooks to supplement them.

To further improve the reliability of your tracking, webhook deduplication can also serve as an additional failover option. In the event that client-side purchase measurement fails or malfunctions, webhooks ensure that you can still capture crucial purchase data. This provides an extra safety net to prevent data loss, so you don't miss out on valuable insights even if technical failures occur on the client-side. This functionality ensures that your tracking or that of your customers remains reliable and accurate, which is essential to the success of your marketing campaigns.

What are Webhooks?

Conversion webhooks for eCommerce webshops allow your CMS system to automatically send a message to other systems; in the case of webshops, a message can be sent from your shop's backend to your server the moment an order is created. These messages are sent directly from system to system so that information can be exchanged directly and efficiently. Webhooks also allow you to measure the purchases of cookie-rejecting visitors (although you cannot see the marketing and user info of that visitor in your marketing and analytics channels).

What disadvantages do Webhooks have?

If something on your site goes wrong with the filling of the marketing object in the webhook, then you have a problem in your marketing and analytics platforms because those platforms will no longer be able to retrace who that visitor is and from what source or campaign they came to the site.

For example, there are many different plugins, apps and modules that can be installed on Shopify, WooCommerce or Magento that can cause problems in overwriting (rather than populating) the order notes.

Reversing your tracking setup at the moment of such a conflicting plugin or script is easier said than done. And as a marketer, you don't want to be constantly concerned with your clients' tracking setup and have it set up as optimally as possible in the future.

How does the AdPage solution work?

At AdPage, we have developed a functionality that ensures that a webhook is sent only if the GA4 purchase event is not registered. This is done by checking if the transaction_id is already available in the GA4 purchase event data. If it is missing, the webhook is sent to still complete the data. But if the transaction_id is recognized, the webhook will be stopped. This way you avoid duplicate measurements and ensure a complete picture of your conversions.

At the server level, which purchase event is forwarded is determined

How do you set up Webhook deduplication?

To activate webhook deduplication for a tracking setup that already uses purchase webshooks, you need the following:

AdPage Deduplication setting

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

Configuration settings on the trytagging environment

X-Order-Exists variable

To enable deduplication, you will need to add a variable "X-Order-Exists" on your sGTM container. That variable is a Request Header variable with the value "X-Order-Exists.

Request Header variable with X-Order-Exists as the value

The Request Header checked by this variable contains the 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 filled with the value "false." If the transaction_id is detected, the X-Order-Exists in the request header is filled with the value "true".

So if you want to pass the purchase event from the webhook, you have to add in the trigger of this tag the condition that the X-Order-Exists variable is 'false'. Once AdPage has done your implementation, you will be using a total of 4 tags for Meta Ads and GA4. Those are these four tags with their triggers:

  • GA4 tag - When an event (except purchase as event name) comes in on the GA4 client
  • GA4 purchase tag - When an /order_created request arrives on the Data Client.
  • Meta Ads tag - When an event (except purchase as event name) comes in on the GA4 client
  • Meta Ads purchase tag - When an /order_create request arrives on the Data Client
The two different GA4 tags and triggers on your sGTM container
The two type of Meta Ads tags and triggers on your sGTM container

To make webhook deduplication work for both platforms, modify the triggers in the following ways:

  • 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, make sure to add the 'X-Order-Exists equals false' condition.
The three new triggers to make deduplication live on your sGTM container

Is this AVG-proof?

Yes, the solution is fully compliant with the AVG and ePrivacy regulations. Once a customer makes a purchase, your company processes the data as defined in the terms and conditions or privacy policy. This means that, after a purchase, you do get to process customer data if explicit consent has been obtained. However, if no consent has been given for the use of cookies, you are not allowed to use your visitors' PII (personally identifiable information) for marketing or analytical purposes, and thus not the marketing and user info, forwarded to your analytical and/or marketing platforms. This makes the solution AVG-compliant: you can still measure your conversions without violating your visitors' privacy. Only you can't link these purchases to a visitor or a marketing campaign, but you do provide 1-to-1 measurements in your analytics platform.

Conclusion

By integrating Webhooks into your GA4 and Meta Ads setup, you ensure that you always have a complete picture of your conversions, even when certain data is missing due to, for example, the absence of the given consent in a cookie banner. With AdPage's webhooks and deduplication features, you can smartly deal with missing data while ensuring an AVG-proof solution. Want to learn more about how you can use webhooks and their deduplication to improve your tracking or that of your eCommerce customers? Contact our team and find out what AdPage can do for you.