Google Analytics Cookie Usage on Websites

This document describes how Google Analytics uses cookies to measure user-interactions on websites.

  1. Overview
  2. analytics.js – Cookie Usage
  3. ga.js – Cookie Usage
  4. urchin.js – Cookie Usage
  5. Google Analytics for Display Advertisers – Cookie Usage

Overview

Google Analytics is a simple, easy-to-use tool that helps website owners measure how users interact with website content. As a user navigates between web pages, Google Analytics provides website owners JavaScript tags (libraries) to record information about the page a user has seen, for example the URL of the page. The Google Analytics JavaScript libraries use HTTP Cookies to "remember" what a user has done on previous pages / interactions with the website.

Google Analytics supports two JavaScript libraries (tags) for measuring website usage: analytics.js and ga.js. The following sections describe how each use cookies.

analytics.js – Cookie Usage

The analytics.js JavaScript library is part of Universal Analytics and uses a single first-party cookie containing an anonymous identifier used to distinguish users.

By default, this library sets cookies on the top level domain, excluding the leading dot, and sets the cookie path to the root level (/).

This library sets the following cookies:

Cookie Name Expiration Time Description
_ga 2 years Used to distinguish users.

Customization

Read the analytics.js Domains & Cookies developer guide to learn all the ways these default settings can be customized.

Read the Security and privacy in Universal Analytics document for more information about Universal Analytics and cookies.

ga.js – Cookie Usage

The ga.js JavaScript library uses first-party cookies to:

  • Determine which domain to measure
  • Distinguish unique users
  • Remember the number and time of previous visits
  • Remember traffic source information
  • Determine the start and end of a session
  • Remember the value of visitor-level custom variables

By default, this library sets cookies on the domain specified in the document.host browser property and sets the cookie path to the root level (/).

This library sets the following cookies:

Cookie Name Default Expiration Time Description
__utma 2 years from set/update Used to distinguish users and sessions. The cookie is created when the javascript library executes and no existing __utma cookies exists. The cookie is updated every time data is sent to Google Analytics.
__utmb 30 mins from set/update Used to determine new sessions/visits. The cookie is created when the javascript library executes and no existing __utmb cookies exists. The cookie is updated every time data is sent to Google Analytics.
__utmc End of browser session Not used in ga.js. Set for interoperability with urchin.js. Historically, this cookie operated in conjunction with the __utmb cookie to determine whether the user was in a new session/visit.
__utmz 6 months from set/update Stores the traffic source or campaign that explains how the user reached your site. The cookie is created when the javascript library executes and is updated every time data is sent to Google Analytics.
__utmv 2 years from set/update Used to store visitor-level custom variable data. This cookie is created when a developer uses the _setCustomVar method with a visitor level custom variable. This cookie was also used for the deprecated _setVar method. The cookie is updated every time data is sent to Google Analytics.

Customization

The following methods can be used to customize how cookies are set:

Read the Tracking Multiple Domains guide to learn how to configure ga.js to measure user interaction across domains.

urchin.js – Cookie Usage

Historically, Google Analytics provided a JavaScript measurement library named urchin.js. When the newer ga.js library launched, developers were encouraged to migrate to the new library. For sites that haven not completed the migration, urchin.js sets cookies identically to what is set in ga.js. Read the ga.js cookie usage section above for more details.

Google Analytics for Display Advertisers – Cookie Usage

For customers that are using Google Analytics' Display Advertiser features, such as remarketing, a third-party DoubleClick cookie is used in addition to the other cookies described in this document for just these features. For more information about this cookie, visit the Google Advertising Privacy FAQ.







Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.