Tracking Campaigns in Google Analytics

Google Analytics provides a simple way to track any marketing that drives traffic to your website without making any changes to your account.

To track marketing campaigns, simply insert campaign information into the landing page’s query string. It looks something like this:
www.mysite.com?utm_source=cpc&utm_medium=google.com&utm_campaign=spring_sale

First, let’s take a look at how Google Analytics keeps track of where a visitor came from.

How It Works

When a visitor lands on a page with Google Analytics tracking code, the code tries to determine where the visitor came from. It looks first at the URL itself. If the URL contains campaign information, it writes this to the visitor’s cookies. If not, it will look in the HTTP headers to see if there is a referrer identified. If it can’t find anything there either, it will mark the visit as direct traffic.

This traffic source information will now get sent to Google Analytics with every pageview (unless it gets overwritten), and that information will be used to populate all the traffic reports for the visit.

This gives us a way to track details of marketing campaigns and how they are performing in context of all the other visitors to a site.

URL Builder

To build these coded URLs, you can use our handy URL Builder tool. This tool will step you through all of the necessary information needed to track a campaign and then construct an encoded landing page URL for you. That’s it. Just identify this new URL as your destination URL and you’re done. The campaign reports in Google Analytics will be automatically populated.

Marketing Campaign Variables

Whether you use the URL Builder or manually create the destination URLs, you need to use the variables correctly.

Campaign Name (utm_campaign)

Required variable – If this advertisement is part of a broader marketing campaign, list the name of that campaign here. Avoid vague acronyms or abbreviations. If there isn’t an official name for the campaign, use the name or phrase you use internally to talk about it. For example, it might be seasonal (eg. “Spring Sale”), or it might refer to the message of the ads (eg. “Two for One Promo”).

Source (utm_source)

Required variable – List where the ad is located or where the visitor is coming from. This is not to be confused with medium (listed below). For example, if it is an ad placed on another site, list the URL for that site. If it’s from regular newsletters, you might list the name of that newsletter.

Medium (utm_medium)

Required variable – This field stores the medium for the marketing being used. For example, banner ads being shown on a site would be listed here as “banner”. Other options include “email”, “ppc”, “direct mail”, etc.

Keyword (utm_term)

This field is only used for ppc campaigns, and it should store the search term for a specific ad. Anything placed in this field will show up in the Keywords reports.

Content (utm_content)

Use this field to differentiate between two ads that share the same name, source and medium. For example, two banner ads on mysite.com for the spring sale might generate different traffic because the content is slightly different. To keep track of this in Google Analytics, enter the differentiating factor here. Maybe one is the “blue ad” and the other is the “red ad”.

Tips and Tricks

Finally, when tracking campaigns, there are a few things to keep in mind.

When to Use

Use campaign variables anytime you spend money or time to get a link somewhere. More than anything else, you need to know whether your resources are being wisely utilized.

Consistency

Since Google Analytics trusts what you input, you need to be careful to be consistent in how you name campaigns, including consistency in capitalization. If you input a campaign medium as “banner” and later input a medium as “banners”, they will be grouped separately.

Establishing from the beginning some consistent naming convention for everything can avoid a lot of confusion later down the road and keep the reports much cleaner.

Human Readable

Google Analytics is generous with its field limits, so there is no need to abbreviate or obfuscate your campaign information. Spell it all out so that nobody needs a secret decoder ring to understand the reports. If you’re concerned about secret spies stumbling across your reports and finding that they are incredibly easy to understand, I’d recommend doing a better job of locking up your offices at night.

Tracking Offline Campaigns

If you have offline advertising, like print, TV or radio ads that you would like to track, you can still use campaign variables. Just give a brief URL in the ad and have that redirect to the correct landing page with campaign variables. Ideally, you would use a different URL for each medium and campaign so that you could get very specific in your tagging.

For example, if you have a radio campaign announcing 10% off of widgets, give either a vanity URL (www.discountwidgets.com) or an easy subdirectory (www.mysite.com/radio-coupon). Have either of these redirect to your landing page with the lengthy campaign information in a query string.

The goal is to give an easy enough URL that consumers will remember and type in instead of just going to your home page or doing a Google search.

Free Traffic

In Google Analytics, free traffic should all be categorized as “direct”, “referral” or “organic” from a search engine. In the absence of campaign variables, these labels will be applied automatically. Make sure that no traffic you are paying or working for is attributed to these medium names.

Next Steps

Products that complement Google Analytics are our Recommended Tools.