ThinkSEM Consulting Blog


November 12, 2009

Google Analytics Cookies

Okay, what are cookies and how do they affect me? (Other than the ooey-gooey kind which add lbs...)

What Are Cookies?
A cookie is a file which describes information about a visitor to the site that created it. Stored on a computer's hard drive, it's somewhat of a mini-record of what sites a user has been visiting. Sounds a bit invasive, but it's really not - anyone can decide whether they want to accept cookies or not. Beware, though, you might not have full functionality on some sites if you disable cookies.

There are (2) types of cookies: persistent and temporary:
  • Persistent cookies: these cookies come with an expiration date set somewhere in the future. They remain on a computer's hard drive until they expire or are deleted by the user.





  • Temporary cookies - these cookies are much shorter-lived than their persistent brothers; they expire as soon as the user closes the browser.
So how does Google Analytics (GA) utilize a teeny file stored on a computer's hard drive?

How Does Google Analytics Use Cookies?
Since the vast majority of users have cookies enabled, Google Analytics uses 1st-party cookies to collect website visitor data. (First-party cookies are those created by the website in question, so only that website can read the data. In this case, GA.)

Along with persistent and temporary cookies, there are different ways cookies can be configured to see whether a visitor is unique or returning; to correlate a shopping cart with search campaigns; even to determine steps visitors take in a navigation sequence.


As you can see, all the cookies are utm cookies that perform various functions. All of these cookies are persistent except the _utmc cookie, which is deleted when the user closes the browser (temporary cookie).

Why All the Different Types of Google Analytics Cookies?
All the GA cookies track differently, but can be used in conjunction to collect data.

  1. _utma - this is the Visitor Identifier cookie. Contains (4) components:

    • domain hash
    • random unique ID
    • timestamps (initial visit, previous session & current session)
    • session counter


  2. _utmb & _utmb - work together as Session Identifiers. As defined by GA, a session = a visit, where 30 minutes of inactivity or the closing of the browser signals the end of a session/visit.

    • _utmb - a persistent cookie which expires after 30 minutes. Contains domain hash and additional values.

    • _utmc - a temporary cookie deleted when the user closes the browser. Contains only the domain hash.

    • Why does Google use both?

      • If a web page is open for 30 minutes without activity, the _utmb cookie expires but the _utmc cookie remains. The next time the user lands on the page, a new _utmb cookie is created, denoting a new session but a returning visitor.

      • With each new page a visitor lands on, the _utmb cookie gets refreshed, so sessions can last as long as the user keeps moving throughout the site without hitting the 30-minute 'inactivity' deadline.


  3. _utmz - this is the Campaign Cookie. Stores campaign tracking values passed by tagged campaign URLs, including utm source, medium and campaign.




  4. _utmv - this is for Visitor Segmentation, and is a persistent cookie. It only appears if the _setVar method is being used, contains the domain hash plus some value denoted by the user. For example, a value can be set that upon a site those visitors who login are 'members' while those who don't login are 'non-members.' By defining those 2 types of visitors, the _utmv can track data that each set is performing.

For any site utilizing Google Analytics for their reporting, this is a basic overview of how cookies are employed to collect visitor data.

*Note: Images courtesy of Google Conversion University.

2 comments:

  1. Typo? "_utmb & _utmb"

    Otherwise good post, thanks!

    ReplyDelete
  2. Excellent, thanks very much. I haven't came across a post giving as much of a breakdown on the utmz cookie previously.

    Cheers!

    ReplyDelete