Use webhooks to measure calls as conversions in Google Analytics

Use webhooks to measure calls as conversions in Google Analytics

You are here:
Estimated reading time: 2 min.

You can use webhooks in our cloud PBX for many purposes. One you might not think of immediately, is tracking your offline conversions. When you’re running a campaign, people might call you about it instead of clicking a button (which you could already track). So how do you incorporate that call in your analytics data? Well, you can use the webhooks feature in your Axeos pbx and be ready in three simple steps:

  1. define your call goal and conversion in Google Analytics
  2. Add a webhook rule to your pbx dialplan
  3. Call and check your analytics dashboard

This is what happens when your office recieves a call: the pbx does a POST request to Google’s API, including this event type and your tracking code in the request body. Analytics will then register the call for your campaign.

Let’s set this up!

Prerequisites: you need to have a google analytics account. Don’t have one? You can register here.

Step 1. Define your call goal and conversion in Google Analytics

Login to your analytics account and define a new goal, e.g. “call”. Now there is lot of options to choose from when using goals and conversions. While we want to enable you to use this, we are no online marketing specialists ourselves, so we keep this article simple. Luckily, Google has done a great job documenting this in their measurement protocol overview. They have a developer guide and a parameter reference which lists all of the parameters for the Measurement Protocol. You can use these to explore further what Analytics can do for you.

How to/webhooks/164

How to/webhooks/165

How to/webhooks/166

How to/webhooks/167

 

Google’s hit builder is a great way to choose your parameters and validate if they are indeed correct, before proceeding to the next step.

Step 2. Add a webhook rule to your dialplan

You can use webhooks anywhere in your dialplan whenever you want to trigger the goal action. In this example we just add it to our main DID. Add a webhook rule (before version 4.1.0 known as ‘data collection’ rule).

  • Rule type: webhook (formerly: data collection)
  • Prompt: not strictly needed, you could choose 1-second silence.
  • Number of digits: 0
  • Exact length: on
  • Service URL: https://www.google-analytics.com/collect
  • Request body: v=1&t=event&tid=UA-XXXXXX&cid=yourcid&ea=call
  • Response body regexp: (empty)
  • On success: continue
  • Condition: unconditionally
  • Description: that’s up to you 🙂

Request body details:

  • v = version
  • t = hit typetid = tracking ID / web property ID
  • cid = required if User ID (uid) is not specified in the request. This anonymously identifies a particular user, device, or browser instance. The value of this field should be a random UUID (version 4) as described in http://www.ietf.org/rfc/rfc4122.txt. E.g. 35009a79-1a05-49d7-b876-2b884d0f825b
  • ea = event action

Note that you need to replace the tid ‘UA-XXXXX’ with your own tracking ID and the ea ‘call’ with the name you’ve given your event.

Step 3. Make a call and check your analytics dashboard

Call registered!

Was this article helpful?
No