How Google Analytics uses cookies to track your visitors
11 Feb 2010
Posted by Jake Rutter as Web Metrics
If you have ever used Google Analytics, you will notice that it tracks how users behave on your site – from which pages they click, which products they purchase, which terms they search, to which browsers they use. It is all done by way of setting/getting different cookies on your customer’s computers, and using those to track them.
Here are some frequently used scenarios and how Google Analytics deals with them.
How is a user session determined?
A visitor session ends after 30 minutes of inactivity on your website, or when the browser exits. Google Analytics is able to determine the start of a new session by the absence of either session cookie. Cookie : __utmb, __utmc
How is a unique visitor identified by use of cookies?
Each unique browser that visits a page on your site is provided with a unique ID via the __utma cookie. In this way, subsequent visits to your website via the same browser are recorded as belonging to the same (unique) visitor. Cookie : ___utma
How are traffic and referral sources tracked?
When visitors reach your site via a search engine result, a direct link, or an ad that links to your page, Google Analytics stores the type of referral information in a cookie. Cookie : __utmz
How can you track custom information using cookies supplied by Google Analytics?
You can define your own segments for reporting on your particular data. When you use the _setVar() method in your tracking code to define a custom user segment, Google Analytics uses this cookie to track and report on that information. Cookie : __utmv
How can perform A/B tests using cookies?
You can use Google Analytics with Google Website Optimizer (GWO), which is a tool that helps determine the most effective design for your site. Cookie : __utmx
Guide to Google Analytics Cookies:
| Cookie Function | Cookie Name | Expirtion |
|---|---|---|
| User Session | __utmb __utmc |
30 minutes from set/update |
| Identifying Unique Visitors | __utma | 2 years from set/update |
| Tracking Traffic Sources & Navigation | __utmz | 6 months from set/update |
| Custom Tracking | __utmv | 2 years from set/update |
| Website Optimizer | __utmx | 2 years from set/update |
Next week I will be going over how you can set custom variables on your site to track certain events/behaviors that are happening on your website back to Google Analytics.
Category Web Metrics
You can follow any responses to this entry through the RSS 2.0 feed.






arnabc
February 12th, 2010 at 6:24 am
Great informative post, waiting for the next post on tracking events, good work Jake :-)
Brian Clifton
February 12th, 2010 at 10:28 am
Hello Jake – I just stumbled on your site on my Friday morning reading round. Nice articles re: GA, WSO…
As you are obvious a GA enthusiast I thought you might be interested in this post from me this morning: http://www.advanced-web-metrics.com/blog/2010/02/…
Brian Clifton
Author