Measure your offline conversions in Google Analytics with the measurement protocol | Articles

It has become increasingly easier for marketers and web analysts to track visitors on their websites over the past few years. On the one hand, web analytics tools have been widely improved and adapted to the need to attribute online conversions to media investments. On the other hand, Tag Management Systems (TMS) have allowed the industry to partially bypass IT teams, making our lives much easier.

As a consequence, it is now incredibly straightforward to attribute an online achievement (signup, transaction etc.) to the designated acquisition and remarketing channels. With reports such as the multi-channel funnels report (MCF) in Google Analytics, you can now have a cross-channel overview of specific online conversions in a couple of clicks. With a correct interpretation of these reports, you can make appropriate changes in your investments and as a result boost your return on investment (ROI). All you need is some basic skills in web analytics and optionally some knowledge about a Tag Management System. You do not have to worry about the linking between sessions and users, most of the platforms do it for you.

The story can end here for most of online businesses. However, for many other businesses who are around in the physical world, the customer journey does not end on the website itself. Several types of conversions can be initiated online and completed offline. This is the case for example of a contract being generated online (lead) then sent via mail to the potential customer’s postal address. The deal is closed when the user returns the signed contract. Another example is the sports betting industry, for which the results of bets depends on the outcome of sport events. As an illustration, we could also mention the coupons that are distributed online and monetised offline. In all these cases, it is impossible to measure the actual ROI of media investments with a basic implementation of web analytics tools. The best you can do is to use the number of leads as a KPI to evaluate your ROI.

The measurement protocol

Fortunately, if you are using Google Analytics, there is a solution out there: the measurement protocol. Simply put, the measurement protocol is the method used to send hit data to Google Analytics. If the measurement protocol sounds unfamiliar to you, don’t be afraid: you’re actually already using it. Indeed, each time a GA pageview or a GA event tag is fired, an HTTP request (a measurement protocol request) is sent to Google Analytics servers with all the hit data. You can see the HTTP request by executing the following steps:

1 - In your browser, right click on the page you track

2 - Click on ‘Inspect’ (Google Chrome)

protocole-mesure-ga1

3 - Select the network tab

4 - Search for ‘collect’

5 - Refresh your page in your browser

6 - Select the request that you want to display

protocole-mesure-ga2

You can see below that the data is sent within the request through parameters. Together these parameters tell a story that's understandable for Google Analytics. E.g: The variable "sr" indicates the screen size (1920x1080) while "vp" indicates how big the viewable area of the browser actually is.

http://www.google-analytics.com/collect?v=1&_v=j41&a=95273961&t=pageview&_
s
=1&dl=http%3A%2F%2Fspendoo.additionly.com%2F&dp=%2F&ul=en-us&de=UTF-8&dt=Spendoo&sd=24-bit&sr=1920x1080&
vp
=596x962&je=0&fl=20.0%20r0&_utma=233387214.2091347972.1408006233.1413183655.1413209274.46&
_utmht
=1457617100090&_u=SCECgAAB~&jid=&cid=704404341&tid=UA-XXXXXXX-1&gtm=GTM-56L5PG&z=XXXXXX

A description of all the parameters can be found here:

https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#general

By using this framework as an example it is fairly easy to manually compile and send a request containing information to Google Analytics without the need for a Google Analytics tag. This is very useful because no Google Analytics tag is fired when a conversion is completed offline. Here is an example on how to send a measurement protocol request in python:

import httplib, urllib

params = urllib.urlencode({

'v': 1,

'tid': 'UA-XXXXXXX',

'cid': '1999709383.1453743725',

't': 'event',

'ec': 'Contract signed',

'ea': 'Product A',

'el': 'Some transaction ID',

'ev': 551,

})

connection = httplib.HTTPConnection('www.google-analytics.com')

connection.request('POST', '/collect', params)

Design your request

Automating such requests is a 10 min job for a developer. However, by simply sending parameters chosen ‘à la carte’ using the Google Analytics developer guides, your requests might just end up being meaningless and/or ill designed. As a matter of fact, a better understanding of some parameters is necessary to properly send data to GA.

Client ID

The Client ID (cid parameter) is the ID that is used by default by Google Analytics to unify the sessions of users. The Client ID is specific to a user’s browser. Multi-channel funnels and attribution reports use this key to aggregate the customer journey through different channels (non-User-ID-enabled GA profiles).

Because your ultimate goal is to calculate the ROI of marketing channels, the Client ID is definitely something you should care about. It will help you linking your offline conversions with all the online channels the users went through before they complete the offline conversion (with the same browser).

The Client ID is stored in the utma GA cookie and looks like this: 987654321.9876543210. The section preceding the dot is a random unique ID. The combination following the dot is the unix time stamp for the initial visit. You can retrieve the Client ID in Google Tag Manager with the following custom JavaScript variable:

function()

{

var match = document.cookie.match('(?:^|;)\\s*_ga=([^;]*)');

var raw = (match) ? decodeURIComponent(match[1]) : null;

if (raw)

{

match = raw.match(/(\d+\.\d+)$/);

}

var gacid = (match) ? match[1] : null;

if (gacid)

{

return gacid;

}

}

You can them set this variable as a GA custom dimension (session scope).

1 - Configure your GA property

protocole-mesure-ga3

2 - Configure your GA tag (optionally in GTM as here below):

protocole-mesure-ga4

In the future, you will now be able to download this data to later insert it as the cid parameter.

User ID

If the visitors of your website can login or be identified by a unique identifier (such as the email address), you should probably leverage it. The User ID is the key used by GA to unify users’ sessions in User-ID-enabled GA profiles. Unlike the Client ID which is linked to a browser, the User ID is linked to a unique users and can therefore be used for cross-device reporting. It is relatively straightforward to add the User ID to your GA hits with GTM by using the standard parameter uid:

protocole-mesure-ga5

You can now see that a new parameter has been added to the HTTP request:

protocole-mesure-ga6

As for the Client ID, it is possible to add the User ID as a custom dimension (user scope). Make sure though to carefully follow Google’s policy: the value should not be PII (personally identifiable information).

(https://developers.google.com/analytics/devguides/collection/protocol/policy)

Once added as a custom dimension, you can retrieve the User ID of visitors and set this as the uid parameter of your measurement protocol request in order to link all the actions of users, even their offline conversions.

Hit type

The hit type is a critical aspect of the design of your offline tracking solution. The hit type can be ’pageview’, ‘screenview’, ‘event’, ‘transaction’, ‘timing’, ‘exception’, ‘item’ or ‘social’.

Why is the hit type so important? Because you don’t want to pollute your reports and because you want to make sure to be able to find relevant information about the offline conversions in the multi-channel funnels report (MCF). For instance, if you track product orders on your website with GA Enhanced Ecommerce, a transaction hit will be sent when your customers order a product on your website. If you choose to track offline order confirmations with a transaction hit via a measurement protocol request, you will duplicate the number of transactions sent to GA with the same transaction ID. As a consequence, your reports will count two transactions for one unique real-world transaction. Tracking offline actions with a new GA goal based on an event or a pageview is often a reliable solution in such cases. You then have to set the hit type parameter to ‘event’ or ‘pageview’.

Custom dimensions

It is possible to send custom dimensions together with your “offline” hits. It is very useful when you want to send data about users who do not visit your website anymore (churn). Indeed, such information cannot be sent together with a tag because the non-visitors won’t trigger your GA tags anymore. Moreover, you can use custom dimensions in your requests to send other additional data, such as CRM data.

The key is the key

Although the Client ID and/or the User ID are required values for an offline conversion tracking system, they are not always sufficient to establish the link between the offline conversions and the marketing channels. You will sometimes still need a key that you can reliably retrieve from the offline event/conversion. This might be a Coupon ID or a Transaction ID, as it is most often the case. This key is in most cases the core element of you offline conversions tracking methodology. Here is how to proceed:

1 - Implement the Client ID and/or the User ID as described above and add them as custom dimensions.

2 - Design a key that will make the link between your online channels and your offline conversions. This could be for example a Transaction ID that you send to GA when a contract is generated and that you retrieve from your business database when the contract is signed.

3 - For each of the conversions that was completed offline, download the associated Client ID and/or User ID from GA (they should now be stored as custom dimensions) using the ID designed in step 2 as the key.

4 - Sent measurement protocol requests with the corresponding parameters (incl. cid and/or uid). As a result, the hits sent will automatically be linked by Google Analytics to the previous marketing channels used by the same users that those who completed the offline conversions.

5 - You can now calculate the actual ROI of your offline transactions and better understand the cross-channel role of your marketing channels in the multi-channel funnels report.

Make it happen

The methodology described above is not a DIY manual. Basic development skills are still needed and your business might have to be slightly re-designed to integrate the linking ID. Nor does this article pretend to give an extensive explanation about the measurement protocol: the surface of the measurement protocol is in fact barely scratched in the previous paragraphs. However, this short article is intended to give you a brief introduction to some concrete applications of the measurement protocol as well as an overview on the approach needed to tackle the calculation of the ROI of your offline conversions. With this high level outline, you’ll be able to better brief your IT team and manage offline integration into GA projects.

Author: Vincent Crochet

Tags:

Get in touch

Semetis | Rue de l'Escaut 122, 1080 Brussels - Belgium

welcome@semetis.com

Connect with us

Cookie Policy

This website uses cookies that are necessary to its functioning and required to achieve the purposes illustrated in the privacy policy. By accepting this OR scrolling this page OR continuing to browse, you agree to our privacy policy.