How Does Google 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, tagged campaign links, un-tagged referral links and direct visits.

Each time a visitor visits your site the Google Analytics Tracking code updates this cookie with the appropriate campaign information. When the cookie is updated GA discards the previous campaign information. As a result GA only tracks the current campaign information, not previous campaign information.

With that said, there is a ‘pecking order’ regarding which activities will overwrite the the data in the campaign tracking cookie. Let’s review how GA buckets your traffic in terms of referral information:

  • Campaigns: links that you have tagged with campaign information
  • Referrals: untagged links on other web page
  • Direct: people who type your URL into a browser
  • Organic: organic search engine traffic

Here is how GA updates the campaign tracking cookie based on referrer:

  • Direct traffic is always overwritten by referrals, organic and tagged campaigns
  • New campaign, referral or organic link that brings a visitor to the site always overrides the existing campaign cookie

Here’s an example. A visitor visits your site from a newsletter with tagged links. They look around and decide to leave. When they leave your site the campaign tracking cookie will persist and indicate that they originated from the newsletter.

The same visitor decides to come back the next day and types your URL into the browser. The campaign cookie will still indicate that the visitor arrived via your newsletter because the second visit was a direct visit, and direct traffic does not overwrite existing campaign information.

With that all said, you can configure GA to NOT overwrite the campaign data that is stored in the tracking cookies. This let’s you identify the first campaign that brought the visitor to your site. Here is the link:

http://www.google.com/support/analytics/bin/answer.py?answer=27247

However, this technique does NOT prevent the Google Analytics Tracking Code from updating the campaign cookie if a visitor arrives by organic search or untagged referral link. This technique can only be used to prevent tagged campaign links from overwriting previous referral information from a tagged campaign link.

So how do you get around this? Well we’ve come up with a hack that we’re using with a few of our clients. The goal is to store all referral information about a specific visitor across all of their visits so we get a better understanding of the sales cycle.

The Google Analytics Tracking Code re-writes the data in the campaign tracking cookie every time the visitor hits the site. We need a mechanism that can store data across multiple sessions and would only update the referral data and not overwrite it. To do this we wrote some JavaScript that uses the custom segment functionality to track the visitor’s referral information.

Here’s a brief outline for what the JavaScript does:

  • When visitor lands on the site check the previous referral information.
  • If there is no previous referral info then gather the referral info and store it in a custom segment using utmSetVar()
  • If there is previous referral info, then UPDATE the custom segment to include the current referral information

While this isn’t an ideal situation it does help. Using the User-defined report we can identify conversion rates for the various combinations of referral information that drove the visitor to your site during the sales cycle.

Obviously this takes some technical know-how. But if you’re working with a client, and the client wants to know EVERY step in the process then this is a hack that can help.

So there you have. Some information about how Google Analytics tracks referral information. I think there are two key things to remember.

  1. Not all referral information is created equal
  2. You can configure GA to let your campaign information persist

You may also be interested in the series I wrote about Campaign Tracking with Google Analytics:
Google Analytics Campaign Tracking Pt. 0: An Overview
Google Analytics Campaign Tracking Pt. 1: Link Tagging
Google Analytics Campaign Tracking Pt. 2: The EpikOne Link Tagging Tool
Google Analytics Campaign Tracking Pt. 3: Reports and Analysis

Thoughts? Questions? Leave a comment.

Be Sociable, Share!

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

    Comments

    1. says

      Using GA, I identified one of my highest referring sources was a direct competitor’s website. I’ve searched their entire site and I can’t find any links on their site that point to my site. (They don’t even do reciprocal linking so it can’t be there.) If another site has absolutely no links to my site, how is it that Google shows that site as a referring source? Does Google track the page you were on immediately prior to the page you visit when you type a direct URL in the browser? If this is the case, the only thing I can figure is that someone with the competitor’s website as their homepage is constantly visiting my site using a direct URL and not clicking a link. Please help me unravel this mystery. – Another Accenture alum

    2. says

      Michael – this is “referrer spam”, pretty much used for subjects you can also find in your email spam. Works for spammer if you make your referrer logs visible (like some weblog of free counters do, I have seen the robots check after spamming if their link appears in public log).

      I’ve seen IPs that have created up to million requests with various referrers… oops, make that “over million”: 216.40.250.26 has made 1 084 458 hits since I banned it a year ago or so.

    3. says

      Hello,
      I had a quick question that I was hoping you may be able to answer. I am using Yahoo CPC and Google Analytics to track it. I used the URL Builder, and created tagged links for all keywords. They were all approved, but Google is not tacking any of the Yahoo CPC at all. Why might this be?

      Thank you for your time and help,
      Howard Portney

    4. says

      Hi Howard,

      If the values from tagged links are not appearing in your GA reports then there may be a problem with your site. When you click on one of your Yahoo! ads do you see the query string variables when you land on your site? If not, then your site is stripping off the variables or the site is doing a redirect. That’s the first ting I would check.

      Hope that helps,

      Justin

    5. says

      Hi Justin,

      I think you’re correct, because when I do a Yahoo search, and click on one of our Cost Per Click ads, I see the exact URL as if I typed it in myself (with no query string variables). I guess my question would be, how can I get my site to show the query string variables when clicking on the CPC ads?

      Thanks again,
      Howard

    6. says

      Howard,

      That’s a pretty tough question to answer. It could be any number of things. You’re best bet is to talk to you IT staff.

      Justin

    7. says

      Hi Justin,

      That’s part of the problem – I AM the IT staff. LOL! Actually my supervisor noticed this yesterday too (the missing query string variables). I tried writing to GA, but they weren’t of much help. I also wrote to Yahoo Search Marketing, and I’m waiting for a response…

      Once again, thank you for your help. At least I know that I’m moving in the right direction now. Thanks again,
      Howard

    8. Nick Guebhard says

      Hi

      Looking at the relationship between different referral sources and conversions has been of interest to me for a while.

      Where can I find the JavaScript that ensures Google Analytics only updates referrer information rather than overwrites it? Also, what effect does it have on reports? If different sources (eg, PPC and organic) are both being credited for a conversion, does this mean inflated conversion total reports? …and if not what report does one use in Google Analytics to see the conversion history through the different referrer sources?

      Look forward to your reply.

      Nick

    9. says

      Hi Nick,

      The hack I described in the post uses the custom segmentation feature of Google Analytics to keep track of the all the marketing touch points in the sales process. The actual code needs to be custom developed by one of your developers.

      When it is implemented you can use the custom segment reports to evaluate which marketing materials influenced the customer.

      Good luck!

      Justin

    10. Frank Dixon says

      Hi,

      I’m an affiliate marketer.

      Is there any way to hack Google analytics in such a way to track affiliate sales down to the keyword level, like it can be done at keywordradar.com or xtreme conversions?

      Thanks.

    11. says

      Hi Frank,

      I’m a little confused by your question. Are you looking to track the keywords that people used to find the sites that you’re trafficking ads on?

      Justin

    12. says

      I’m new at this, so forgive me if this sounds naive or obvious, but it looks as if I don’t need affiliate software/programs if I am using Google Analytics? That as long as I know the right things to do, GA will give me all the benefits of an affiliate program without buying a new one and having to learn it? Is this right? Thx.

    13. says

      Hi Nat,

      Thanks for your question. I’d love to give you a definitive answer, but the real answer is, it depends. Google Analytics is a web analytics tools. It tracks how people got to your website and what they did while they were on your website. Google Analytics will also link a conversion back to where the visitor originated from. It sounds like that what you need.

      Justin

    14. says

      Thanks for this great article. It completely answered my question regarding how different referrers take precedence over each other. Do you happen to know how long the analytics tracking cookie persists. I did not see this information in the article or comments.

      Thanks!

    15. Nilesh says

      I have a setup a campaign in GA for my newsletter. I have defined various source/medium combinations based on certain criterias.
      Suppose a user comes to my site by clicking on a link the page visit for that source medium combination will increase.
      Now if the same user comes to the same page by directly typing the url browser probably on some other day will there be an increment for that source/medium combination.

    16. says

      Hi Nilesh,

      Yes. If someone initially visits using a tagged link, and then visits the site directly, then GA will record 2 visits for the initial source/medium combination.

      Thanks for reading and thanks for the comment.

      Justin

    17. says

      Hi Justin,

      Is there a way to get the conversion source to print on a contact form? Someone in a GA forum said I would need to parse out the source from the _utmz cookie and put it in a hidden form field.

      The web site and form are coldfusion. I’d don’t have a clue as to how this would be done. Any help is appreciated.

      I really learned a lot from your GA ebook – great job!

      Thanks – Leslie

    18. says

      Hi Leslie,

      The answer to your question is in the PDF! Check out the section on CRM integration. The same technique can be used to print a conversion source on a contact form.

      I’ll try to write a post about it soon.

      Justin

    19. says

      Hi Justin-

      Do you know of any way of distinguishing bookmark visitors from direct type in visitors? It looks like they are group together under “Direct” and I’d like to separate out the prospects (New visitors) who are arriving via a bookmark from those that are typing in adsense.

      Is there a hack to do this?

      Thanks

    20. says

      Hey Charlie,

      The only thing I can think of is to change the destination URL that is used for the bookmark. Unfortunately you don’t have much control over that unless you add a ‘bookmark this site’ link and tag the site URL with the campaign tracking parameters. That should work.

      Thanks for reading and let me know if that works for you.

      Justin

    21. says

      Hi Cham,

      Yes, Google Analytics will identify a visitor’s country. GA does a reverse DNS lookup to map the visitor’s IP address to a geographic location. While it is not 100% accurate it does a pretty good job.

      Thanks for the comment.

      Justin

    22. Dana says

      Hi Justin,

      A very helpful page. I hope you can help with this… it may be a very basic question to many, but I have been unable to find the answer. I realize that “direct” means typing a URL into the browser directly, but what about if someone forwards an email with a link? If someone clicks on that link, does that count as a direct source or a referral as far as Google Analytics is concerned?

    23. says

      Hi Dana,

      It depends. :) If the link in the email was tagged with the utm_ parameters, then the visitor will be bucketed according to the values in the link tags. If the link has not been tagged then the visitor will show up as a referral, if they use a web-based email client (like GMail). Or, if they use a regular email application (like Outlook) and the link has not been tagged, they will show up as a direct visit.

      Thanks for reading and I hope that helps!

      Justin

    24. says

      Hi Justin,

      I am wondering whether it is possible to track the user “action” of clicking on an email (mailto:xxx) embedded in the site?

      Thanks,
      Suzuki

    25. says

      Hi Tshwarelo,

      GA uses a first party cookie to identify new visitors. Those that do not have a cookie are identified as a new visitor, those with a cookie are identified as a returning visitor.

      Hope that helps,

      Justin

    26. Jeff says

      HI Justin,
      Great content here as always. Perhaps you can offer assistance on the following.
      In my GA account under Traffic Sources->Keywords with the Ecommerce Tab selected, I don’t see any transactions at all linked to the referring keywords?

      In most cases I see the referring keyword that brought the sale to my site in my shopping cart’s new order emails, “order trail” but when checking that keyword in GA, no conversions are attributed to that keyword.

      I think it’s because while on the site users are at http://www.mydomain.com, but once they enter checkout the url becomes https://secure1.make-a-store.com/cgi-bin/domain/Make-a-Store.cgi….etc.
      So they are breaking the initial session that came from that keyword/domain, so it doesn’t carry over into a “conversion” in GA.

      I’n not quite certain which of the following Google recommendations to implement in this case, per the help docs? cart:http://www.google.com/support/analytics/bin/answer.py?answer=55532&ctx=sibling

      Any help would be appreciated, Jeff :)

    27. says

      Great info, great site Justin. I also have a question. Currently I have configured my GA set up to be linked to my Adwords account. As such, Adwords is currently being reported as “google/cpc” in GA. Is there a way of changing it to something like “google/cpc – campaign” without disabling auto-tagging?

    28. says

      Hi Will,

      You can change the way your data appears without disabling auto-tagging. You’ll need to create a new profile and add a filter to the new profile. The filter should concatenate the campaign, medium and source information. If you’ve never dabbled in advanced filters it can be a bit confusing. Here are a couple of screen shots to help out:

      GA filter #1 for adding camapign data.

      GA Filter #2 for adding campaign data.

      Remeber, make sure you create a new profile and add these filters to the new profile. You’ll find the data in the Traffic Sources > Campaigns report.

      Thanks for the question,

      Justin

    29. Abhishek Singh says

      HI Justin,
      i have to get a internal search report in GA but the problem is that te portal we are using does not uses query string but uses session variable.can i get a repaort in this case.

      Thanks a lot in advance.

    30. Vanessa says

      Is it possible to get time/date details on when someone clicked a referral link to our site? I get that it tracks how many clicks, but cannot seem to drill down as to when those clicks are happening.

    31. says

      Is there any way to track the conversion delay through Google Analytics? i.e. track how long it takes for each paid search lead to convert from the moment they first clicked on the ad, based on the cookie window.

    32. says

      Rhonda,

      Due to the campaign attribution model that GA uses, it’s very difficult to track the original referrer (meaning the very first click that brought the visitor to the site).

      If you’re looking for how long it takes people to convert, you actually need to use e-commerce tracking. GA will only measure conversion latency, i.e. how many visits, or how many days, it takes someone to convert.

      Check out this post on using GA for non-commerce sites

      Hope that helps.

      Justin

    33. says

      Vanessa,

      You can track when people visit your site. So you equate a click to a visit, which is not 100% accurate but fairly close. Use the Visitors > Visitor Trending reports. You’ll notice a time of date view under the date range selection tool.

      Hope that helps,

      Justin

    Trackbacks

    1. [...] And finally, to wrap this part up, it’s worth being sceptical no matter what precautions you put in place when trying to interpret the results; for example: How Does Google Analytics Track Conversion Referrals?. Possibly related posts: (automatically generated)Library Analytics (Part 2)Trial Databases – “Test drive” a databaseFind a Database by subjectLibrary Databases Temporarily Unavailable [...]

    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>