Analytics App Download FAQ Help Blog About

Google Analytics for Email Campaigns

When you think of Google Analytics, you think of measuring statistics for visitors to your site from search engines, pay-per-click, and direct referrals. But Google Analytics is designed to do a whole lot more, and works perfectly for measuring response from email campaigns!

Even if you use a really nice email marketing service like (my favorite) or, which track clicks from your emails, it is still important to track the visitors from those emails in your Google Analytics, so you don’t get them mixed in with other sources and campaigns. Additionally, you can track conversions, navigation, and other important factors that help you to improve conversions.

Setting up Analytics tracking from your email campaign is really simple, you just need to include a few items in your email links and a few lines of javascript (provided below) on your landing page. Here’s an example, and then we’ll discuss each variable individually:
(cont'd) &source=Newsletter&campaign=12-23-2008+Newsletter

medium - Starting with the most general item, “medium” defines the delivery vehicle, the advertising medium, for your visitors. I recommend just using “email” and then no matter how many different email campaigns you send out, you can segment them all together by medium.

source - Getting to some more granularity now, “source” helps you separate out your different types of email campaigns. You may have varying types of emails going out, such as: Newsletters, Customer Service emails, Surveys, Announcements, etc. This variable lets you segment those together, so you can watch how your Newsletters or Surveys as a whole perform.

camp - This is the most specific variable (camp short for “campaign”) that should vary with each of your email campaigns that go out. If you had a newsletter for December, you may want to put “December+2008″ as the value, or if it was part of a promotional offer, “Winter+Sale”.

Now for the last step, you need to put these 3 lines of code into your Google Analytics Javascript. Here are the 3 lines to add:

pageTracker._setCampMediumKey("medium"); // medium
pageTracker._setCampSourceKey("source"); //source
pageTracker._setCampNameKey("campaign"); // campaign

After you put those three lines in in, your code should look something like this:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? 
(cont'd) "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + 
(cont'd) "' type='text/javascript'%3E%3C/script%3E"));

<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-85279-31");
pageTracker._setCampMediumKey("medium"); // medium
pageTracker._setCampSourceKey("source"); //source
pageTracker._setCampNameKey("campaign"); // campaign

TIP: It won’t cause problems if you just put the 3 lines of code in site-wide, like if you use a template or include for your Analytics javascript.

Once you have the link ready and the code on your landing page, you’re ready to send off that next email campaign! Then you can harness the power of Google Analytics with your email campaigns to see how your recipients interact with your site and if they convert.

In a future post I’ll discuss how to analyze the data from your email campaigns using Google Analytics. Be sure to subscribe to the RSS feed so you can keep up with all the latest tips and help with Google Analytics!

Category: Email Campaigns

2 Responses to “Google Analytics for Email Campaigns”

  1. Clelmegameshy - now in my rss reader)))

  2. Cameron

    This is valuable information. But why set custom campaign variables? Why not use the variables built into GA (utm_medium, utm_source, utm_name, etc.)? They’re easy enough to understand and don’t require any extra code on your site.

Leave a Reply

Back to top