100% van je eCommerce conversies meten via Webhooks

Blog cover: webhooks vanuit backend voor orderdata
In this article

Measuring conversions is crucial for lead generation websites and eCommerce web shops to analyse the success of marketing campaigns. Traditional tracking methods have been impractical for some time now, and a standard Server-Side Tagging tracking setup cannot guarantee 1-to-1 conversion measurements. These missed opportunities and inefficiencies in your tracking can be resolved using webhooks. By using webhooks at the point of conversion, you can send real-time data directly to your server from your website's backend, enabling 1-to-1 measurements in your marketing and analytics platforms. In this article, we explain what webhooks are, how to use them for accurate online tracking, and the advantages and disadvantages of this approach.

Webhooks zijn een automatische manier om informatie te verzenden van de ene applicatie naar de andere, zodra een bepaalde gebeurtenis plaatsvindt.

Webhooks are HTTP callbacks that enable real-time communication between different web applications. In simple terms, this means that webhooks ensure that systems automatically send messages to other systems when certain events occur. Sending these messages happens directly from system to system, allowing information to be exchanged immediately and efficiently.

In the case of online tracking, webhooks are primarily used to detect important events such as purchases and refunds from users on the backend of a webshop and to forward them to an external tracking or analytics tool via your server. When a specific event occurs on your webshop's backend, an HTTP request is generated with all relevant data and sent to the pre-configured URL of your server container. In the case of a webshop, you can therefore set it up so that the moment an order is created in the backend, a webhook filled with e-commerce, user, and marketing information is sent directly to your server. From your GTM server container, you can transform the incoming data in that webhook into the correct events and parameters that your marketing and analytical platforms can receive and process.

To best feed a marketing algorithm with data about converting site visitors and to achieve the most accurate overview of conversions per campaign or per marketing platform, you want to collect this data as accurately as possible. However, webhooks can also muddy your collected data. When does it make sense to deploy webhooks for your online tracking setup?

Je gebruikt webhooks wanneer je een applicatie wilt laten reageren op gebeurtenissen in een andere applicatie zonder dat je daarvoor constant de andere applicatie hoeft te bevragen.

Webhooks for measuring your conversions are used when your tracking setup has too large a margin of error in the number of measured conversions. You want to feed your marketing algorithms with complete data as extensively as possible and see the most comprehensive overview in your reports, and with webhooks, you take that extra step towards complete accuracy and data-driven decision-making. The example below will explain how webhooks work in combination with a Server-Side Tagging tracking setup.

A common misunderstanding about server-side tagging is the assumption that it provides a 100% accurate way of tracking. While it is certainly more accurate than tracking solutions like third-party scripts or client-side tagging, there will always remain a small margin for missed visitors or events. Server-side tagging provides a solid foundation for accurate tracking, but it's important to understand that it's only one part of a broader strategy to measure as accurately as possible.

Although Server-Side Tagging provides a reliable foundation for accurate tracking, there is still a degree of error in conversion measurement. This is because the creation and sending of events to the server happens via the Google Tag Manager web container, which runs within the user's browser. And you have no control over what happens in your visitors' browsers.

There are several reasons why this margin of error can occur.

  • Redirects: Sometimes a user ends up on a different page than the thank you page, where for example the datalayer is not active. Redirecting site visitors is not stable enough to guarantee it will never go wrong.
  • Loading script: It can happen that scripts, such as the data layer script or the tagging pixel, are not loaded correctly on the thank-you page. Websites are usually a mix of content from different providers: ads, analytics, tracking, widgets, social media, etc. Depending on the website's design, each of these providers can affect the performance of others.
  • Latency Latency (the delay between a request being submitted via a web application and receiving a response) can play a significant role in website performance. It's an important factor for your search engine optimisation (SEO), among other things, but a slow-loading website can also mean visitors leave before a page and its scripts have fully loaded.
  • Standard user browsers: Another common situation is when a visitor proceeds from the checkout page, for example in Google Chrome, to the payment application and then the thank you page is opened by default in their device's default browser, such as Safari or Samsung Internet.

Essentially, client-side tracking is vulnerable to these kinds of small but impactful errors. Webhooks offer a solution, as you can always rely on the accuracy of incoming events (except in the case of a technical error), without the risks associated with client-side tracking.

In the visualisations below, you can see how the communication flow works with and without webhooks in a Server-Side Tagging setup.

In addition to errors that can occur in your visitors' browsers, you also cannot see conversions in your analytics platform, such as Google Analytics, for visitors who indicate through the cookie banner that they do not wish to be tracked (for analytical purposes). With webhooks, you do have the option to measure this conversion so that you have an accurate overview in your analytics platform, but you cannot attribute this conversion to a previous session or a user. You were not allowed to track that user and session, so you cannot and may not trace the user of the conversion. However, the eCommerce data is sent along so that you have a good overview of the number of conversions and the conversion values.

To effectively use webhooks for attributing conversions to your user or campaigns, you need to include the user and marketing information of your visitors. Otherwise, you still won't be able to trace conversions back to your visitors and the marketing campaigns that led them to your site. You can't just set up webhooks; there are specific technical and marketing requirements that are important in setting them up so that your marketing and analytics platforms can process the received conversion data.

Om webhooks te gebruiken, heb je een URL nodig waar de webhook naartoe gestuurd kan worden. Dit is meestal een ingestelde URL op je server of een service die de webhook kan verwerken.

To effectively use webhooks, both technical and content-related requirements must be met. Firstly, it is essential to configure an endpoint capable of receiving and processing webhook requests. This means you need a server that can accept HTTP requests and process the data correctly. With AdPage's servers, you don't have to configure the acceptance of HTTP requests yourself. However, you will need to transform the collected data to forward it to your marketing and analytics platforms. There are also requirements for the data you send with your webhooks, which you will therefore transform in your Google Tag Manager server container.

The content of the JSON payload (the marketing object) sent with the webhook must contain various types of information, such as user data and marketing information. The most important thing about the webhook is that it contains the same marketing object that is also used in the front-end. In the AdPage plugins for WooCommerce, Shopify and Magento is this marketing object stored with an order so that this marketing object is always available to be sent along. Below you can find an example of a marketing object for webhooks:

{
  "event": "trytagging_purchase",
  "e-commerce": {
    "transaction\_id": "43",
    "affiliation": "",
    "value": "45.00",
    "tax": "0.00",
    "shipping": "0.00",
    "currency": "Euro",
    "voucher": "",
    "items": [
      {
        "item_name": "test product",
        "Brand": "",
        "item_id": "23",
        "item_sku": "",
        "price": "45.00",
        "item_category": "Clothing",
        "quantity": 1,
        "index": 1
      }
    ]
  },
  "user_data": {
    "customer_id": 1,
    "billing_first_name": "Jeroen",
    "billing_last_name": "Test",
    "billing address": "Velmolenweg 54a",
"billing_postcode": "5404 LD",
    "Belling country": "The Netherlands",
    "billing_state": "",
    "billing_city": "Without",
    "billing_email": "jeroen@adpage.io",
    "billing_phone": "0612345678",
    "shipping_first_name": "Jeroen",
    "shipping_last_name": "Test",
    "shipping company": "",
    "shipping_address": "Velmolenweg 54a",
    "shipping_postcode": "5404 LD",
    "shipping_country": "The Netherlands",
    "shipping_state": "",
    "shipping_city": "Without",
    "shipping_phone": "",
    "Email": "support@adpage.io",
    "First name": "Jeroen",
    "surname": "Test",
    "New customer": "false"
  },
  "marketing": {
    "_ga": "GA1.1.1818643883.1707129196",
    "_ga_LZN92VD7GK": "GS1.1.1711477035.19.0.1711477041.0.0.462628796",
    "user_id": "6fa957c2-52d9-905a-94fe-dfc53b5cef72",
    "client_id": "4132502f-435b-32c1-eaa4-84b37b95f846",
    "session\_id": "1711477035",
    "session_count": 19,
    "Facebook": null,
    "FBC": null,
    "gclid": null,
    "gbraid": null,
    "Wig": null,
    "referrer": "",
    "utm_source": null,
    "utm_medium": null,
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
    "IP": "127.0.0.1"
  }
}

Although webhooks are very powerful in providing real-time data and automation, their success is heavily reliant on how they are set up within the specific platform. This brings us to the next section, where we will delve deeper into configuring webhooks in various eCommerce platforms, and how to ensure they perform optimally within your specific environment.

Setting up webhooks for WooCommerce, Magento and Shopify webshops

Webhooks for purchases, among other things, can be configured in various e-commerce platforms via AdPage's solutions. Each platform has its own unique features and requirements for configuring webhooks, meaning the approach will vary slightly depending on the platform your online shop runs on.

WooCommerce

Via the WordPress plugin van AdPage Is the functionality for WooCommerce webhooks automatically loaded, in addition to the DataLayer, the tagging pixel, and the cookie restoration function. These webhooks are sent directly to the same server as the tagging pixel upon a WooCommerce purchase. However, nothing is done with these webhooks until you apply the following settings in the Google Tag Manager server container: Setting up WooCommerce webhooks.

Magento

Via the AdPage Magento module Is the functionality for webhooks automatically loaded, alongside the DataLayer and tagging pixel? These webhooks are sent directly upon purchase to the same server for which the tagging pixel is configured. However, nothing is done with these webhooks until you apply the following settings in the Google Tag Manager server container: Setting up Magento webhooks.

Shopify

Within Shopify, notification settings are already present in your store's settings. This makes setting up Shopify webhooks simple. Here you can set up a webhook to a specific URL for various backend events, such as an order being created or cancelled. So for a new order that is created in the backend, you would set it up so that it goes to your server's URL with /order_created appended: tagging.domeinnaam.nl/order_created.

This only works if you also use the AdPage DataLayer and tagging pixel. Without these components, the marketing object will not automatically be populated with the necessary marketing and user information.

To then process the received webhooks via the Google Tag Manager server container into a purchase or, for example, a refund event, follow these steps: Configure Shopify Webhooks.

Bespoke

Don't use Shopify, Magento or WooCommerce but do want to use webhooks for your conversion tracking? Then you can also set this up as a custom solution. This helpdesk article explains how to set up the AdPage DataLayer, how to fill the marketing object, and how to set up the webhooks: Custom webhooks setup.

Conclusion

Webhooks are a valuable addition for e-commerce online shops aiming for efficiency and accuracy in their communication and data processing. They offer the ability to automatically and in real-time react to events, which not only saves time but can also increase customer satisfaction. Although implementation requires some technical knowledge, the benefits are often significant. Whether you use WooCommerce, Magento, or Shopify, setting up webhooks can help you take your online shop to the next level. Give it a try and discover how webhooks can improve your business operations.

Curious how we can grow together?

Let's get in touch!

We'll review your situation and look at where the opportunities lie.

  • We'll look at your current tracking setup together.
  • Honest advice for tracking optimisation
  • Suitable for agencies and brands with their own webshop
No obligation
Bram en Jochem van AdPage