Google Analytics Campaign Tracking Pt. 1: Link Tagging

What is Link Tagging?

To track your marketing campaigns Google Analytics uses a technology called link tagging. This provides a fine level of detail about marketing efforts. The data we gather from link tagging helps us make informed business decisions about our marketing spend.

With link tagging, we add additional information to the destination URL used in an ad. The technical name for this additional information is the query string. Here’s an example:

http://www.cutroni.com/landing_page.php?utm_campaign=fall-sale

&utm_medium=banner&utm_source=boston.com&utm_content=text-only

*** NOTE: I moved some text to a second line for readability ***

Everything after the question mark is called the query string. Within the query string we have a number of parameters. Each parameter is separated by an ampersand (&). Pulling apart the above query string we find the following parameters:

utm_campaign=fall-sale
utm_medium=banner
utm_source=boston.com
utm_content=text-only

Each parameter can be further divided into two parts; a variable (the text on the left side of the equals sign) and a value (the text on the right side of the equal sign). Let’s break the above parameters into variable – value pairs:

Parameter Variable Value
utm_campaign=fall-sale utm_campaign fall-sale
utm_medium=banner utm_medium banner
utm_source=boston.com utm_source boston.com
utm_content=text-only utm_content text-only

Ok, stick with me. We’ve gone from a query string, to parameters, to variables and values. Now, let’s start to explain what all of this means. What are the variables and values? I’ll start by explaining the variables:

Variable Meaning
utm_campaign The name of the campaign. Think of this as a bucket. It holds all of our marketing activities. For example, we may be buying some keywords on Google, running some banner ads and sending out an email all to advertise our winter ski sale. However, these three activities are all part of a bigger marketing campaign, our ‘Winter Ski Sale’.
utm_medium I like to think of the medium as the mechanism, or how the message is delivered to the recipient (i.e. email, banner, CPC, etc). What is the ‘distribution method’ that is used to get our message out to our clients?
utm_source Think of utm_source as the ‘who’. Who are you partnering with to push your message. If you’re tagging CPC links the source may be Google, Yahoo! or MSN. This could also be the name of a service that will be pushing banner ads for you.
utm_content The version of the ad (used for A/B testing). You can identify two versions of the same ad using this variable.
utm_term The search term purchased (if you’re buying keywords). This is not always used and is NOT included in the above example.

It’s important to note that you do not always need to use every variable. The core variables are utm_campaign, utm_source and utm_medium. You should always use those three. With Campaign, Medium and Source you’ll reap the most benefit from Google Analytics.

Just to recap, link tagging is the process of adding additional information to the destination URLs we use in our ads. This additional information consists of variables and values.

Here’s the really cool part, the values. The value for each variable is a piece of business information that will end up in Google Analytics. Let me clarify that, you’re actually taking information that is specific to your business, like the name of a marketing campaign, and placing it in Google Analytics. GA will display it, exactly as it is typed, in a series of reports called the Marketing Campaign Results (see Part 3 of this series). This is extremely powerful because you can look at your analytics data through the lens of your business.

So now we know everything about what link tagging is, but what happens after we tag our links?

When someone clicks on a tagged link Google Analytics, using the urchin.js JavaScript, stores all the values in a cookie on the visitor’s machine. That way we can track the traffic generated by each marketing campaign. When a visitor completes one of our goals we can view the marketing activity that drove them to the site.

It’s important to understand that the cookie will persist until 2038. It’s also important to understand that the cookie will be updated with other information. For details about how Google Analytics stores various referral information please see the following post: How Does Google Analytics Track Conversion Referrals?

How to Tag Your Links

The process of Link Tagging is simple. Start by identifying the information that you need to place in the variables. You need to identify the campaigns, mediums and sources that you use in your marketing activities and place it in your destination URLs. Then modify your destination URLs to include the new variables and values.
How do you do that? You can use any text editor, the Google Analytics URL Builder or the special tool I discuss in Part 2 of this series. I’m partial to the special tool :)

Remember, if you’re placing links to your site in cyber-space, you should be tagging them.

Be Sociable, Share!

    Like this post? Sign up to get posts delivered to your inbox.

    Comments

    1. says

      What is your opinion regarding GA tracking vs. the good old fashioned SEO strategy of keeping links pure.

      Would google perhaps view the link with tracking as a paid link instead of organic?

      In other words, does a link take an authoritative, or equity, hit when it contains the tracking information vs. without out.

      What are your thoughts?

    2. says

      Hi Christian,

      The link tagging parameters are only present when a visitor views a page after clicking on a tagged link. The link tagging parameters are not permanent, and therefore would never be seen by a a search engine.

      Hope that clarifies things,

      Justin

    3. says

      Thanks Justin, but I’m not sure I agree.

      When I take my links with a campaign tagging, I am, inessence, adding tracking to those links in the form of variables.

      When a SE spider combs my site, sees the link to whatever landing page, it also sees the appended variables on the URL.

      My concern is that anything other than a clean link *could be* perceived by the SE as a paid link since it carries tracking variables.

      Google, especially, seems focused on separating paid links from organic links when applying link pop (or equity, or whatever), and my goal is to get the search engine benefit of relevant linking, and NOT get an organic link flagged as ‘paid’

      does that makes sense?

    4. says

      Hey Christina,

      I think the part that we’re mixing up is where link tagging happens. You only add parameters to the links in your emails, banner ads, etc. You modify the destination URL that you place into your ad. You don’t actually change the URLs of any pages on the site.

      The only time the campaign parameters should ever be seen, by anyone, is when a visitor clicks on an ad with tagged links.

      SE crawlers should never see the link tagging parameters as the links with those parameters should only exist in ads.

      The only time that a SE crawler might see the query string parameters is if you post a link that contains the query string parameters on a message board, blog comment, etc.

      Hope that clarifies things,

      Justin

    5. Kathleen Devilbiss says

      Are you aware of a way to manually code the campaign variables on a landing page? We have an affiliate program that drives traffic to a unique landing page and it would be easier to code the three variables on the landing page then to have to update all of the links to the page with these? Is there a way to do that?

    6. says

      Hi Kathlene,

      We’ve been toying with this idea, but it’s really hard to implement. We would need to reverse engineer the GA tracking code and we’ve had little luck with that.

      This is a very common request and we’ve elevated it to Google.

      Thanks for reading and thanks for the comment.

      Justin

    7. says

      Juvaly,

      I see a couple of things wrong with your URL. First, there are multiple question marks. You should only have one question mark to separate your path from the query string parameters and each query string parameter should be separated with a &.

      I also noticed you’re using one campaign tracking parameter. You need to use at least three (utm_campaign, utm_medium and utm_source) to track a campaign in GA.

      Hope that solves your problem!

      Justin

    8. says

      Hi Justin,

      When using the EpicOne link tagging tool, I produced a result difference from the one from Google’s URL builder. When “term” contained three words, Google’s tool gave me a tagged URL like this:

      &utm_term=great%2Bred%20tulips

      …whereas the EpicOne tool produces

      &utm_term=great red tulips

      What do you think? Thanks!

    9. Robert says

      Ok, so the link to the landing page is “tagged” with the url parameters, but what if the goal page is different than the landing page? Do I have to write code to propagate those url vars from the landing page to the goal page? Or will Analytics automatically associate a successful goal with the campaign vars from the landing page, even if those vars are not present in the goal page url?

    10. says

      Robert,

      No need to propagate the tags in all your URLs. Once the visitor lands on the site GA copies the values out of the URL and stores them in a cookie. Then all visitor actions are attributed to the value in the cookie.

      Thanks for the question.

      Justin

    11. says

      Greg,

      Thanks for the heads up. The Google URL builder does an encode on the white space. Not super important, but not a bad thing to replicate. We’ll try to add it in.

      We’re actually building that functionality into Analytics view. Look for it soon!

      Justin

      • says

        Hi Rosanne,

        I have 2 suggestions for link tagging:

        1. Be logical. Make sure your link tags can be understood by everyone in the organization.
        2. Be consistent. Don’t change the values that you use. Always use the same values for mediums and sources.

        Other than that, I like to add dates whenever possible, usually to the campaign name. I like to use simple things for medium, like “email”, “banner” and “cpc”. When it comes to email, I like to set the source to the segment of traffic receiving the email (more thoughts on email tracking here).

        Whatever you choose stick with it.

        Hope that helps and thanks for the question,

        Justin

    12. Bob says

      Is it possible by GA which particular user has been clicked on the particular tagged link and also how many times he clicked for particular user?

      • Justin Cutroni says

        @Bob,

        Technically yes, you can see which users click on links. But the GA TOS clearly states that you can not track any personally identifiable information in Google Analytics. Plus, tracking individual users will generate a TON of data, which is not particularly trackable. That’s why I don’t get into tracking individual users.

        Thanks for the comment,

        Justin

    13. Mike says

      This question may already be answered in this thread… but it is too huge to scour through at the moment… I am wondering if I lose tracking accuracy in this situation…

      I post banner ads on websites such as http://www.racerxonline.com , and I add the tracking codes to the link back to my home page. I get tracking stats under the campaign tracking in GA, but I still get stats showing up in the referral category from racerxonline.com . Do I combine these two figures to make it accurate? Or are some of the figures being created on both ends from the same visitors?

      • Justin Cutroni says

        @Mike: It could be that some of the banners are not tagged with the link tagging parameters. Use the referring sites report to identify which pages on the referring domain have links back to your site. It could also be that, for some reason, the links are getting stripped off. And finally, is it possible that there are other, non-banner, links on the referring site?

        In a perfect world all of the traffic should appear from the banners.

        Hope that helps!

    14. says

      Great post! One more tip, if you set your medium to cpc or ppc then those keywords will appear in the ‘paid’ section of your keyword report.

      Our tool, Campaignsync, can do all this tagging automatically to your Microsoft adCenter or Yahoo! Search Marketing campaigns. It’s free so try it out and let us know what you think.

    15. says

      @Mike: It could be that some of the banners are not tagged with the link tagging parameters. Use the referring sites report to identify which pages on the referring domain have links back to your site. It could also be that, for some reason, the links are getting stripped off. And finally, is it possible that there are other, non-banner, links on the referring site?

    16. Lincoln says

      I had a question about campaign tracking codes. You are only suppose to place these on links that arrive on your site from third party content (emails, banners, social sites, etc). Correct me if I’m wrong, but you should NOT be placing these on links within your site. For example, if you have a promo tile on your site you don’t want to track that cross-link on your internal site with a campaign code, correct?

    17. says

      Thanks for the clear explanation Justin. One question:

      Is it safe to put a 301 redirect on this:
      http://www.cutroni.com/landing_page.php?utm_campaign=fall-sale&utm_medium=banner&utm_source=boston.com

      to this:
      http://www.cutroni.com/landing_page.php

      Would the campaign tracking still be caught before the 301 redirect? This would be a great way of getting the initiating the campaign tracking, and then forwarding the user to the unmodified URL. Would like to know your thoughts. Thanks!

      • says

        Hi Bill,

        Unfortunately no. The GA JS will not have fired in time. You need to make sure that the utm parameters are in the URL when the visitor lands on the site. However, if I remember correctly, you can create a 301 that let’s the query parameters persist. But double check me on that, I’m no SEO expert.

        Justin

    18. vangelis says

      Hi, i am facing the strange problem that a link tag url, that i have added in an swf is indexed in google!! how is this possible? the link url is sth like http://www.sitename.com/?utm=etc... is this happen because the string query goes without a .php or html? thank you for in advance

      • says

        @vangelis – Google is indexing that URL because it’s a completely valid URL. You can use Google’s Webmaster Tools to define a canonical URL and remove the duplicate with the utm_ parameters.

    19. Newbie says

      Hi all,

      I always thought Campaign Tracking is used when a company/an individual sends out emails relatively rarely as the links should be generated manually with the URL Builder and then added to the links in the email manually. Is this right?

      What about regular newsletters? What if a website sends out daily around 10 different emails to more than half a million subscribers? The content/links in those emails is generated automatically based on the content published on the site in the past 24 hrs. Is it possible to use campaign tagging in an automated way so that every link in a new email gets tagged automatically (e.g. medium, campaign name, links position in the mail and month) before the email gets sent out?

      Thanks a lot!

      • says

        Hi Newbie, if the email is pointing people back to your site then you should tag the links. If you don’t tag the links then how will you know how much traffic you get from the email newsletters? Most email tools have some type of GA plugin that will automatically tag the links for you. Ask your provider. If you’re using a home-grown tool then I suggest you tweak it to automatically tag the links for you.

        Hope that helps!

        Justin

    20. tech2 says

      Someone pls help me.

      I understood the URL tagging part.
      But how to view the reports in GA. I mean how to read events reports in GA.

      Many thanks

      Take Care

      • says

        @Tech2: Use the Traffic Sources > Campaign report in Google Analytics. It will list all of your tagged links using the value you added for utm_campaign. You can also change that reprot to view the Medium and Source values.

        Hope that helps!

    Trackbacks

    1. [...] In Part 1 of this series I explained that Google Analytics campaign tracking is based on a technology called link tagging. Link tagging is the process of adding business information to the URLs that we use in our on-line ads. But how do we actually tag these links? Some marketing campaigns can have hundreds, or thousands, of destination URLs. Google has provided a tool for us called the URL Builder. It’s great if you only have one or two links to tag, but it can’t handle hundreds of links. [...]

    2. Google Analytics at a Glance…

      How Does Analytics Track Conversion Referrals? Visitor campaign information is stored in a cookie on the visitor’s machine. This cookie stores the referral information for the visitor’s session. This cookie tracks organic referrals,……

    3. [...] The key to measuring the effectiveness of an email offer is identifying how many conversions occur. Measuring email conversions is pretty easy with Google Analytics. It all starts with link tagging. If you’re unfamiliar with link tagging then you may want to take a moment and review how it’s done. Testing emails with GA starts with creating different variations. Once the variations have been created you need to tag the emails so GA can identify each one. [...]

    4. [...] You can see that the name value pairs look very similar to the parameters we use for link tagging. Just by looking at the above cookie you can figure out that the visitor performed an organic search on Google for the term ‘google%2Banalytics%2Bshortcut’ or ‘google analytics shortcut’. That’s the type of information that we want to put in hidden form fields and send back to the server. [You can learn more about the __utmz cookie in the reference section below.] [...]

    5. [...] Name the filter. Choose “Custom” from the Filter Type drop-down menu. Click the “Include” radio button. Choose “Campaign Medium” from the Filter Field drop-down menu. Type “cpc|ppc” as the Filter Pattern. The “pipe” character is part of a regular expression that means “or”. For this feature to track your Google Adwords paid traffic correctly, Auto-tagging much be turned on in Google Adwords. Linking your Adwords and Analytics accounts will enable Auto-tagging. For it to work with other paid search platforms, you must use link-tagging. [...]

    6. [...] Unfortunately, Yahoo and Mircosoft do not automatically tag paid keywords so the only way to track keywords is to tag them yourself. I know it sounds like it may take up the rest of your day, I assure you it is not as bad as it sounds. The first step is to go to the Google URL tool builder and make a tag for your keywords. If you would like some general information on how to tag links with the URL builder visit this blog post at Anayltics Talk. [...]

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>