Using the Google Analytics Measurement Protocol to Track Email Opens
When you set up Google Analytics you add tracking code to your website either using the standard GA tracking snippet or via a tag management solution such as Google Tag Manager.
By default Google Analytics tracks page views. You can however also extend tracking to also capture additional user interactions via event tracking, virtual page views or use e-commerce tracking to capture online transactions.
Until Universal Analytics – the latest version of Google Analytics – tracking however stopped there. If you had other payment systems, CRM systems or essentially any other systems connected to the internet it was not possible to incorporate the data into GA.
Introducing the Measurement Protocol
This all changed with the introduction of the measurement protocol – a technical set of rules on how to send data to Google Analytics servers and incorporate the data into your account. With the measurement protocol the potential is enormous. Examples of how it could be used include tracking offline transactions, sales team follow ups and even footfall in a real world store.
Tracking Email Opens
As a simple introduction to how the measurement protocol can be used let’s take a look at tracking email opens from a marketing campaign. Whilst many email management tools will provide you with these statistics wouldn’t it be great if you could also incorporate this data into Google Analytics?
First things first – you’ll need to be using Universal Analytics. If you are using the older classic or asynchronous versions you’ll need to upgrade. It’s also essential to note that as part of Google’s terms of service that you can’t use any information here that could personally identify an individual. This means that names and email addresses are out.
Data is sent to Google Analytics via an “HTTP request” – not as complicated as it sounds as to track email opens you can simply add an HTML image tag to the footer of your email.
Building the Code
The code starts of as the following:
You then need to replace the AddCodeHere above with a series of statements to tell Google how you’d like to track email opens and the account to send the data to.
You next need to add:
&tid=UA-XXXXXXX-X – replace the XXXXXX-X with your Google Analytics property code (go to Admin and click Property / Tracking Code if you are not sure of this.
&cd= YYYYYY – this is a unique random number that anonymously identifies a particular user or device (via a client ID). Many email software solutions will be able to complete this via a dynamic parameter (for example you could use *|UNIQID|* in MailChimp).
&t=event&ec=email&ea=open – this code is then required to indicate you want to capture the interaction as an event, the category should be email and the action should be “open”.
Finally you’ll want to add a final set of parameters to attribute the email open to a particular campaign. For example you may wish to track the campaign as a newsletter promoting a spring offer for which the tracking code could be:
Replace the campaign source value (after &cs) and campaign name (value after &cn) as required.
Bringing It All Together
Putting all of this together you’ll end up with an image tag similar to the following (where you will have amended the items in bold).
<img src="https://www.google-analytics.com/collect?v=1&tid=UA-XXXXXXX-X&cd= YYYYYY&t=event&ec=email&ea=open&cs=newsletter&cm=email&cn=spring_newsletter_2016"/>