Wednesday, November 2, 2016

How to Build a Google Analytics Tracking Code

How to Build a Google Analytics Tracking Code was originally published on BruceClay.com, home of expert search engine optimization tips.

Need more input?

Like Johnny Number 5 eats the Encyclopedia Britannica in the above clip from the 1986 gem “Short Circuit,” as optimizers we are constantly looking for more input.

Google Analytics tracking codes are one way we can track how recipients are interacting with our content.

Also known as UTM codes, tracking parameters or custom campaigns, Google Analytics tracking codes are custom tracking parameters that communicate granular information about how visitors interacted with your calls to action to arrive at your owned properties.

This guide describes:

Jump to each section with the links above … or dive in now.

When to Use a Tracking Code

Use UTM tracking codes to see how traffic came to your owned web properties from across the web.

Use a tracking parameter any time you link to a URL on a domain or app you own. You will get the tracking data in Google Analytics for verified domains.

You can use UTM tracking parameters when linking to your owned property from any location: banner ads, email newsletters, social media content, and any other campaign that links people to a property that you own and manage in Google Analytics.

You cannot use UTM tracking to analyze clicks to third-party websites, like YouTube.com or Wikipedia.org. To track click activity on links that send people to properties you don’t own, Bitly is a great resource — and it’s free.

How to Format a UTM Tracking Code

To implement a UTM tracking code, add your parameters to the end of the URL you want to track for insights.

Here’s an example URL with UTM. In this example, the link is posted to Facebook.

http://www.bruceclay.com/blog/amplify-seo-employee-advocacy/?utm_source=facebook&utm_medium=social&utm_campaign=liveblog

Part 1: URL of the page you’re linking to with a “?” at the end

Part 2: utm_source=

Part 3: utm_medium=

Part 4: utm_campaign=

UTM_Source=Awesome Google Analytics tracking code parameter

Bruce Clay, Inc. does not recommend or condone using “awesome” as a Google Analytics UTM code parameter. (But we may or may not find it amusing.)

How to Put Together a Google Analytics Tracking Code

There are five possible parameters you can set for each UTM tracking code:

  1. Source
  2. Medium
  3. Campaign
  4. Content
  5. Term

You should always use the Source, Medium and Campaign parameters; Content and Term are optional and primarily used for paid advertising. Google goes into detail about each parameter type in its support page here.

To keep this guide simple, we will only discuss how to use the three required parameters: utm_source, utm_medium and utm_campaign.

Source

Google defines the Source parameter as such:

utm_source: Identify the advertiser, site, publication, etc. that is sending traffic to your property, for example: google, newsletter4, billboard.

Common Source parameter data used within the BCI content and social media department include blog, newsletter, facebook and twitter.

Medium

Google defines the Medium parameter as such:

utm_medium: The advertising or marketing medium, for example: cpc, banner, email newsletter.

Medium conveys the big picture — how to classify the medium by which your link was presented to the user.

Campaign

Google defines the Campaign parameter as such:

utm_campaign: The individual campaign name, slogan, promo code, etc. for a product.

The Campaign parameter is even more specific than Source, and the parameter where you can really start to get granular with your tracking.

The Campaign parameter gives you the power to identify the specifics of a link placement, all the way down to the color and size of the call to action, if desired.

To illustrate, here are four of the most recent Campaign parameters we’ve used in content marketing efforts:

utm_campaign=smm: The content we publish to the blog may serve to deepen our expert, authority content supporting our silos, or content themes. For example, I linked to the last post on Snapchat marketing for millennials with the Campaign parameter “smm” so that I can see how popular our social media marketing content is.

utm_campaign=toolset61upgrade: With the release of SEOToolSet 6.1, we engaged in a campaign to invite SEOToolSet Lite subscribers to try the newest tools release. Links from our engagement email campaign contain this Campaign parameter.

utm_campaign=liveblog: Our conference liveblogging is a campaign. We invest in sending livebloggers to major digital marketing conferences with the goal of driving traffic to the site. Understanding when we’re getting traffic from liveblog content is key to evaluating this investment.

utm_campaign=seonewsletter-101816: We publish the SEO Newsletter monthly. The campaign “seonewsletter” tells us that traffic to the site is drawn by newsletter content. The date tells us what edition of the newsetter they clicked to see.

Tools for Building UTMs

You’re going to get pretty good at hand-typing a UTM pretty fast after you’ve done it a few times.

But if you’d rather use a tool to create the UTM for you, keep these handy.

7 Essentials Rules for Formatting Google Analytics Tracking Codes

1. Every UTM tracking code starts with a question mark (?utm_). This question mark tells Google Analytics where your link URL ends and your tracking starts.

If you don’t include the question mark, Google will think your link is http://www.yourwebsite.com/your-cro-landing-page-articleutm_source which, as an alteration of the URL permalink, will result in a 404 error. The question mark is important.

2. There are five possible parameters you can set for each UTM tracking code: Source, Medium, Campaign, Content and Term.

The parameters you choose to use are strung together in one sentence (no spaces) and separated by ampersands (&).

3. It doesn’t matter what order you list your parameters in, but your first parameter must start with a question mark and all the following parameters must start with ampersands.

The “&” tells Google Analytics where one parameter ends and the next begins.

If you forget the ampersand and write your code like &utm_medium=viralutm_campaign= Google Analytics will think that your Medium is “viralutm_campaign=” which, as you can imagine, will skew your Medium and Campaign data pretty badly.

4. The best practice is to use dashes to separate words in a UTM parameter.

If you end up using spaces, Google Analytics will fill in the spaces with the percent sign or plus sign.

Dashes are preferred to underscores, although both work. For the backstory, see Matt Cutts’ behind-the-scenes explanation: dashes vs. underscores.

5. UTMs are case sensitive. Keep it simple. Stick with lowercase.

UTM codes are case sensitive so Google Analytics will collect data for potatoes and Potatoes as two separate reports.

Since Google Analytics does not have the human sensibility to tell you that there is a capitalized version of your Campaign floating around somewhere in your referral traffic data, you may be analyzing incomplete data if your team isn’t careful about capitalization.

It’s good to have team-wide ground rules that everyone is aware of. “Stick with lowercase” is a good rule of thumb.

6. You must own the destination of a URL in order collect data from attaching a UTM to it.

In other words, you can only use UTM tracking to assigned parameters to links that go to your properties — your website, your blog, your app, etc. You cannot use UTM tracking to analyze clicks that go to properties you don’t own, like your page on Facebook.com or your store on Amazon.com.

7. And finally, it is critical to have a discussion about UTM parameter conventions before anyone on your team starts creating UTM codes willy-nilly.

The Google Analytics URL builder makes it easy for your team to stay in sync when creating and propagating UTM tracking codes. Create a spreadsheet or other living document (a Google Drive spreadsheet works great) that clearly outlines internal conventions and consistent parameters.

The last thing you want is your campaign data split among variations, caused by issues as simple as pluralization or capitalization. You may be analyzing incomplete data if your team isn’t consistent.

Why Use Tracking Codes?

Use Google Analytics tracking codes to measure where referral traffic is coming from, which initiatives are meeting traffic goals, how target markets prefer to receive communication, and the ebb and flow of an industry based on seasonality.

UTMs give you a granular snapshot of your traffic, how your consumers (and potential-consumers) are interacting with the calls to action you’re putting out there, and they are a great way to quench an unrelenting need for ROI data.

Are you a Johnny Number 5? How have Google Analytics UTM codes made your life easier?


This post was originally published on May 16, 2013, and updated on Nov. 2, 2016.

No comments:

Post a Comment