How to track conversions with webhooks

Discover the guide to tracking Conversions with Webhooks

Tracking conversions with webhooks is probably one of the most useful tip you’ll learn from our blog. But before you can learn this trick, let’s first see what webhooks are.

Webhooks are the kind of URLs that allow business applications like Hubspot, Typeform or Drip to send and/or receive in “near real-time”, meaningful events to and from other applications. For example, Hubspot can fire a webhook url to Mailchimp when a new subscriber opts-in to your list, or when a lead status is updated to “Sales Qualified”.

When marketers ask me how webhooks can be used for performance marketing, I often say:

Webhooks are to growth hackers what postback urls are to performance marketers.

Laurent, Co-Founder @ AnyTrack

Since a webhook url is provided by an application server, the data sent with the webhook url can be processed by the application server.

There are countless cases where webhooks can be used, but in this guide I will walk you through the steps to track conversions in webhooks so you can track conversions from any business app.

What are the differences between Webhooks and Postback URLs

While webhooks and postback share similar characteristics, they work differently. Essentially, the main difference lies in the way the conversion data is appended to the URL. One common trait between webhooks and postback url, is that in both cases, the URL itself is provided by the receiving party. The receiving party, is for instance AnyTrack (when it’s a postback url) and Zapier for a webhook.

The key difference between webhooks and Postback URL:

Webhooks:

The Parameters are arbitrarily appended to the webhook url by the sending party at run time (when the event triggers the webhook url). Therefore, as a marketer the URL you will add to your app is stripped of any parameter.

				
					https://hooks.zapier.com/hooks/catch/6076119/opk19yg/
				
			

Postback URL:

The parameters are preset by the receiving party, and the values sent to the postback are set as placeholders that can be also called macros or tokens.

In the example below, the query parameters and values are clearly seen after the ?

For example:

  • affiliateId is the parameter
  • !!!affiliateId!!! is the placeholder

At run time, the affiliate network will substitute the placeholder !!!affiliateId!!! with a real value – for instance aw1234456.

				
					https://t1.anytrack.io/iQGheK7P/collect/awin?affiliateId=!!!affiliateId!!!&bannerId=!!!bannerId!!!&clickRef=!!!clickRef!!!&clickRef2=!!!clickRef2!!!&clickRef3=!!!clickRef3!!!&clickRef4=!!!clickRef4!!!&clickRef5=!!!clickRef5!!!&clickRef6=!!!clickRef6!!!&clickThroughTime=!!!clickThroughTime!!!&clickTime=!!!clickTime!!!&commission=!!!commission!!!&commissionGroups=!!!commissionGroups!!!&groupId=!!!groupId!!!&merchantId=!!!merchantId!!!&phrase=!!!phrase!!!&products=!!!products!!!&searchEngine=!!!searchEngine!!!&transactionAmount=!!!transactionAmount!!!&transactionDate=!!!transactionDate!!!&transactionId=!!!transactionId!!!&url=!!!url!!!&transactionCurrency=!!!transactionCurrency!!!&trackedAmount=!!!trackedAmount!!!
				
			

Webhook structure

The webhook is composed of two elements. The base URL that is placed in the system and that will fire the conversion (the ecommerce platform, CRM or payment gateway).

Hubspot webhook settings

And the payload data, which has a predefined structure of key value pairs and parameters, set by the sending party at run time (when the event is triggered).

The webhook URL

The webhook URL is the base URL which has some identifiers set by the webhook provider.

				
					https://hooks.zapier.com/hooks/catch/6076119/opk19yg/
				
			

The data payload

The Webhook data payload is usually appended as a JSON file which carries key value pairs and objects. The data can then be parsed and extracted according to your needs. In the example below, you can see plenty of values that are very useful and some that are less relevant to our needs. Yet, having the data available can prove useful in the future.

The webhook example below shows the JSON payload sent by the Typeform webhook. While the JSON language is standard, the parameters are arbitrarily set by Typeform, and other providers like Drip or Unbounce will have different parameters.

The payload below is coming from a TypeForm quiz

Without going through too much details, and just by looking at the payload, you can see the “value pairs” that were sent to the webhook url.

  • event_type – which tells us what type of event triggered the webhook url
  • event_id – which is an auto-genenerated and unique id provided by Typeform
  • submitted_at – which is the “timestamp” of the submission
  • at_click_id – which is the AnyTrack click_id passed to the form which we will use in the Zap to send the conversion to AnyTrack
  • form_id – which is the id of the form, which we can use in the zap to identify which form was submitted.

Essentially, while knowing that a form was submitted is very important, unless you know the content of the submission, the event itself is not very useful.

				
					[
    {
        "event_id": "01F5K2TF58KR2Y4GN85WB0WK09",
        "event_type": "form_response",
        "form_response": {
            "form_id": "aGZ9c8",
            "landed_at": "2021-05-13T14:41:27Z",
            "submitted_at": "2021-05-13T14:41:51Z",
            "hidden": {
                "at_click_id": "lnTCi8vbhkzSs6nijJkz9Wi0Zaf3p31qvP"
            },
            "definition": {
                "title": "Typeform Anytrack integration",
                "fields": [
                    {
                        "title": "what is your email address?",
                        "type": "email"
                    },
                    {
                        "title": "What website are you promoting?",
                        "type": "website"
                    }
                ]
            },
            "answers": [
                {
                    "type": "email",
                    "email": "webhooktest@anyrack.io",
                    "field": {
                        "type": "email"                    }
                },
                {
                    "type": "url",
                    "url": "https://anytrack.io",
                    "field": {
                        "type": "website"                    }
                }    
            ]
        }
    }
]
				
			

What are the use cases for tracking conversions with webhooks

Long are gone the days where you could track conversions on a “thank you page”. Today more than ever, and with the rise of so many business apps, conversions are no longer coined to a “thank you page”. Conversions can happen in many contexts and in various forms. Whether online, offline, or in a business app like Calendly, conversions have become the “data fuel” of any businesses.

But more importantly, tracking a certain type of conversions while ignoring others, is like leaving money on the table.

Partner marketing

When you work with an advertiser or partner and you want to receive or send conversion event notifications.

Offline conversion tracking

When your sales are happening offline and you need to send conversions to your Google Analytics or Facebook Conversion API.

Third party apps

When your traffic lands on Typeform or Calendly, tracking conversions with webhooks is almost your only option to guarantee a clean data collection.

Cross domain tracking

Similar to “third party apps” and equally complex, your ability to track conversions across multiple domains – whether you own them or not – is challenging.

Let’s dive in!

Prerequisites for tracking conversions with webhooks

  1. You need an AnyTrack account.
  2. You need a webhook provider like Zapier or Integromat (in this guide we will use Zapier).

Reminder about conversion tracking

In order to track conversions AnyTrack will generate a click_id and will AutoTrack & AutoTag the product link or partner links users click on. The AnyTrack Tag does it automatically for product links or forms that are part of the integration catalog. In the cases where you want to track a partner that isn’t integrated, you will have know into which parameter to pass the click_id .

If you don’t know which parameter to use, you should ask your partner, or check in their support documentations.

To illustrate this flow, we will use the popular form provider Typeform.

💡 What are Postback URLs?
If you are not familiar with Postback URL, you should learn our detailed article about Postback URL

The Typeform to AnyTrack conversion data flow:

  1. Visitor lands on your landing page
  2. Visitor fills the Typeform
  3. Typeform fires the Zapier Webhook
  4. Zapier receives the event data
  5. Zapier fires the AnyTrack Postback URL
  6. AnyTrack tracks the conversion and sends the event to your Analytics and pixels.

Step 1: In your AnyTrack account

  1. Create a custom affiliate network
  2. Add dummy values in the postback fields (don’t worry, we will used them later)
  3. Copy the Postback URL and paste it in a notepad

Step 2: In Zapier

  1. Create a new zap
  2. Select webhook as the trigger
  3. Copy (ctrl+c) the webhook

Step 3: In Typeform

  1. Insert the webhook in the Typeform Webhook settings
  2. Open your landing page and submit the Typeform
Add a webhook to typeform

Step 4: Return to Zapier

  1. Click to test the zap and analyze the data sent by Typeform
  2. Select the event that was just triggered
How to track conversions with webhooks 6
  1. Click Next and select the Webhook app (this time we are going to use Zapier to “call” the AnyTrack Postback URL)
  2. Now select the Post Action
  3. Open your notepad where you pasted the AnyTrack postback URL
  4. Remove everything after the URL path (including the question mark 👉 see illustration)
  5. Paste the Postback URL in Zapier Webhook Action Field
Use Zapier to fire webhook for conversion tracking
  1. Now add the following fields in the form
    • click_id and select the corresponding value which is the click_id that was passed by AnyTrack to Typeform.
    • conversion_type > type in formSubmit
    • brand_name > select the select the form name / title
    • transaction_id > select the event id value
  2. Now test the Zap and you’ll see the data show up in AnyTrack!

AnyTrack & Zapier Integration

With the Zapier & AnyTrack integration, you can leverage your conversion data in over 3000 business applications.

Takeaways

As you can see, there are a number of ways you can use webhooks for your conversion tracking needs. Everything becomes much simpler, and your data can be streamlined across your marketing tools, with little to no efforts.

While “webhooks” were mostly used by developers to build data pipelines between apps and services, they are now widely used across industries and disciplines.

Personally I think I’d be totally lost without webhooks. They have the granularity that I need to collect meaningful data, and tools like Zapier or Integromat give me the option to work and test new business apps in minutes.

Laurent Malka

Laurent Malka is the Co-Founder of Anytrack. He was born and raised in Switzerland, and now lives and works in Israel. He is a serial entrepreneur with over 15 years of experience in marketing and business development. Laurent has been a panelist and speaker at numerous digital marketing events including SEMrush and IG Affiliates. He prides himself on his ability to connect the dots across disciplines, industries, and technologies to solve unique challenges.

Don't forget to share this post!
Share on facebook
Share on linkedin
Share on twitter

Ready to turn more visitors into conversions?

Discover how quickly your data can help you scale!