This is a follow up to Tracking Actions in Interactive Email which covered the mechanics of tracking user interactions in email using the selective loading of background images. This post will cover how to use Google Analytics to serve up the tracking pixel and provide the tracking reports.
A not so well known feature of Google Anaytics (GA) is the ability to track email events – specifically tracking email opens. By carefully constructing your analytics pixel URL you can also use that to track user interactions in your kinetic campaigns.
If you don’t yet have a Google Analytics tracking ID (UA-XXXXX), follow this link to get one.
Analytics Link Structure
Following this guide your tracker pixel URL will look something like this.
tid = Google Analytics tracking ID (ie. UA-XXXX)
cid = Unique session id (recipient id)
t = Tracking type (set to “event”)
ec = Event category
ea = Event action
el = Event label (optional)
cn = Campaign name (optional)
cs = Campaign source (required for campaign tracking)
There are a few more variables that you can track using the GA link such as campaign medium (cm) and custom variables. In fact you can go so far as to use custom dimensions to tie users to visits to your website – but for our purposes we’ll stick with the basic set.
Assigning values to the variables
Depending on your familiarity with Google Analytics, you may already have an established way to use the GA variables so the following is just one of several possible ways to assign them.
Set the “tid” variable to your GA tracking ID, and leave the “t” variable set to “event” to let GA know you’re tracking an event as opposed to a page view.
Event category (ec) can be seen as a way to group your events. I like to set mine to “kinetic”.
Event action (ea) is where you can specify the type of event tracked – ie interact, open, client-type, animation etc.
Event label (el) is optional and you can use it to track the type of interactions be it generic (ie. rollover, clicked) or specific such as the unit that was interacted with (ie. unit1, unit2 etc). You can use this to track the client type as well (webkit, mobile, gmail-webmail etc).
You can use campaign name (cn) and campaign source (cs) to track your reports by email campaign. Campaign source is required if you want to track by campaign name, and you can use any value – I just use “email” here.
Unique Session ID (cid)
The unique session id (cid) is an identifier that uniquely identifies the user session. Normally you’d use the recipient’s email address, but unfortunately Google does not want you to do this. According to the docs, information passed to GA must not be personally identifiable information (pii).
In order to comply with the PII requirement, you may have to resort to your Email Service Provider (ESP) to give you some sort of ID that identifies the user other than their email. MailChimp has a merge tag *|UNIQID|* that produces a user’s ID.
Integrating the GA Pixel
Now that you’ve got your GA pixel URL you can integrate the pixel into your campaigns.
One of the cool features of Google Analytics is the ability to see realtime events as they happen. This allows you to instantly test if your pixels are configured properly. You can send a test campaign (or just load the HTML within a browser) and your interactions will appear immediately in the realtime view.
You can get to the realtime view through the left side menu Real-Time -> Events. Clicking on the “Events (last 30 min)” option allows you to see the total number of events per event action fired.
From the above animation you can observe that the delay in the recording of an event is relatively short. Also note that due to the fact that once the pixel is loaded in a page it is not retrieved again unless the page is refreshed, activating the rollover event the second time did not produce a recorded event.
Here’s the exciting part. You can get to the events reporting section in Google Analytics through the left side menu Behavior -> Events -> Top Events.
Once you’re at Top Events, you can see all the events broken down by event category. Clicking on the “kinetic” event category, you can see all the event actions as shown below:
Total Events and Unique Events
In the above screenshot, you can see two metrics Total Events and Unique events. Total Events is basically the number of times the pixel for an event has been loaded.
However Unique Events is not the number of unique users that have triggered an event. It refers to the number of sessions that an event has taken place in. For example if a single user opened an email 10 times in 3 days, Total Events would show 10 as expected, but Unique Events will actually show 3 and not 1. Google Analytics starts determines a new session has ended if it detects no events from a user after 30 minutes. See this article for more information
In order to show how many unique users has triggered an event, you’d need to add the Users column using a Custom Report.