This post talks about a step-by-step approach for tracking email opens in Google Analytics. Yes, GA can also be utilized to track email opens, besides its regular analytics duties. However, as the email clients cannot run the GA tracking (JavaScript) codes, email opens cannot be tracked just by embedding the GA tracking code.

Image by Megalytic.com
Here are the steps that you must follow to track email opens in GA.
Step 1: Google Analytics Setup
Your Google Analytics account must be set up to track email opens. But assuming you are already a Google Analytics (GA) user, I’m not getting into the nitty-gritty of setting up a Google Analytics account. If you are totally new to the GA platform, all you need to do is create a Google account (which you most likely have), and set up your GA account, simple!
Step 2: Creating the Tracking URL
Email opens in Google Analytics is tracked by embedding an image pixel within the body of the email. When a user opens an email, the email client fetches this image. This image then passes on the email tracking information to the Google Analytics servers, which you can then view in your Google Analytics account.
But before creating an image, we must create a special tracking URL. This URL must be structured in the manner as required by Google Analytics.
The basic structure of the URL is https://www.google-analytics.com/collect?v=1.
It includes the GA domain name (google-analytics.com) to link to the GA server and then appended with the phrase “collect?v=1” that tells the servers that we are collecting data with the URL. The v=1 is just the GA protocol version.
For this URL to track the email opens, we need to append a bunch of parameters to it. These parameters will predominantly store pieces of information about the tracked event, the user who is opening the email, email campaign, and will also include your GA Tracking ID, which tells the GA servers to pass on the parameter data to the appropriate GA account.
Most of these parameters may seem meaningless to you, but they are required by Google Analytics to correctly interpret the tracked event (email open). These parameters are attached to the main URL and interlinked with the “&” sign. (E.g. &tid&cid….)
Finding the Tracking ID in GA
The first parameter that must be added to the URL is the “tid”. This parameter passes on your GA tracking ID (which you can fetch from your Google Analytics account as explained below) to Google Analytics. It must be assigned the value as tid=UA-12345678-1 (I’ve used a dummy tracking id)
To find the Tracking ID,
- Log into your GA account
- Click on the ‘Admin’ button (
) on the bottom left corner of your GA account
- Click on the ‘Tracking info’ under the ‘Property’ section to reveal your Tracking ID.
The other parameters that we need to append to the URL are,
- cid = CLIENT_ID _NUMBER (a tracking ID for the user/customer)
- t=event (this parameter tells GA that it is a Hit Type Event)
- ec=email (ec is Event Category, which tells GA that the event category is “email”)
- ea=open (ea is Event Action, which conveys the event action to GA, which is “open” in this case)
- el=recipient_id (el is Event Label that assigns a unique id to the recipient of the email and passes on to GA)
- cs=newsletter (cs is Campaign Source. GA uses it to segregate campaign types, here I’m using the type “newsletter”)
- cm=email (cm is Campaign Medium. GA uses it to segregate campaigns based on mediums (e.g. email, social media and so on)
- cn=MY_EMAIL_CAMPAIGN (cn is Campaign Name that passes on the campaign name to GA. You can assign any custom campaign name to this parameter)
- dp=%2Campaign%2Newsletter (dp is the path of the tracked item. Here I’m specifying it as /campaign/newsletter. “%2” is the equivalent of “/” in URLs)
- dt=Weekly%20Newsletter (dt is the title of the tracked item. I have named it Weekly Newsletter, you can give any other name as you like. %20 is the equivalent of space in a URL)
The final tracking URL with the appended parameters will look like this,
https://www.google-analytics.com/collect?v=1&tid= UA-12345678-1 &cid=CLIENT_ID_NUMBER&t=event&ec=email&ea=open&el=recipient_id&cs=newsletter&cm=email&cn
=MY_EMAIL_CAMPAIGN&dp=%2Femail%2Fnewsletter1&dt=My%20Newsletter
Step 3: Creating the Image
Now with the tracking URL ready, we can create the fake image pixel by enclosing the URL within a simple HTML Image tag:
Step 4: Embedding the Image in the Email (Creating a test email)
The process of embedding the above HTML Image tag into your email body is not a straight-forward one. Here are the steps you need to follow.
- Paste the tag into Notepad as shown in the pic below.
- Give an appropriate name to the file and save it as an HTML file. Set the “Save as type” value as “All Files (*.*)” before saving. Please note that I have added a text “Email open tracking test email” above the HTML Image tag just to ensure that the file has loaded successfully in a browser.
- Open the saved HTML file in a browser to see that it’s loading. You will see the added text if the file is loaded successfully.
- Now copy the text from the browser and paste it into your email client software editor (e.g. Apple Mail, Outlook, etc.). Send the email to your email id or any other test email id that you own, remember this is just a test mail.
- Open the received email in your email id to trigger the event (email open). Now go over to your Google Analytics account to check if the event has been captured or not.
Step 5: Check if the email opens are captured by Google Analytics
To see if the tracking-URL enclosed image tag has successfully passed on the email-open tracking information to GA, log into your GA account, and check the Events section under Reports à Real-Time. If you see an entry under the “Event Category” like the one seen in the pic below, Congratulations, the email open tracking event has been successfully captured by the GA account.
Drawback – A major one indeed!
This event tracking technique did not work on traditional browser-based email programs like Gmail and Yahoo etc. That was a bummer! Hence it felt like a lot of effort setting up an email tracking system that wouldn’t work on top email clients like Gmail and Yahoo. Barring that disadvantage, this is a neat technique to track the email users using desktop email clients like Outlook and Apple Mail and so on.
Wrap up
See? Tracking email opens in Google Analytics is not that hard provided you know how to set up the system. Hopefully, this post will serve as a useful guide for that. If you know of any other method to track email opens in GA, please do let us know by dropping a comment.