Google Analytics Cookies (utma, utmb, utmz)

Google Analytics uses cookies to keep track of visitors' web statistics. When you install Google Analytics javascript tracking code on your website, cookies are written to your visitors' computers to keep track of their activities on your website. Cookies store visitor's first visit, page views, how long they stayed on your site, entry point, and exit point among others. Cookies set by Google Analytics include __utma, __utmb, __utmc, __utmv, __utmx, and __utmz; and samples of those cookies are as follows:

__utma is a persistent cookie which expires in 2 years from the last update. It is used to track first visit, last visit, current visit, and number of visits. The content of this cookie value is separated by a dot, and stores domain hash, random ID, time of first visit, time of last visit, time of current visit and session counter. A sample __utma cookie value looks like below:


__utmb is used to track user's pageviews on your site, and expires from 30 minutes from last update. The content of the cookie include domain hash, pageview, number of outbound link click counting down from 10, and current time stamp. A sample __utmb cookie value looks like below:


__utmc used to track session status but it is no longer used. The value contained domain hash.


__utmv allows you to create custom variables to segment different group of users, and track their behaviors. This cookie is only present if you, as a domain owner created a custom variables in Google Analytics. The __utmx cookie is only created if you create an experiment in Google Website Optimizer, a tool used to perform split testing.

__utmz keeps track of entry point into your website storing traffic source, medium, campaign, and search term used to land on your website. The cookie value inclue Domain hash, current timestamp, session count, and campaign information. The cookie is updated with each page view, and expires in 6 months from last update. A sample __utmz cookie value looks like below:

111872281.1339100387.4.4.utmcsr=google|utmgclid=COTI5Pb0vLACFeUBQAod0F9c3w|utmccn=Mobile> PHP Programming|utmcmd=cpc|utmctr=exact_web development|utmcct=11189174903::adpos_1t2::network_g

If a user deletes those cookies, there is nothing you can do to restore history of visitor's web statistics. Whenever a user deletes __utma and __utmz cookies, the history information is permanently deleted from their computer. If they visit your website again after deleting those cookies, they are considered a brand new visitor to Google Analytics.

To retrieve GA campaign cookie in PHP, use the following code.

Retrieve GA campaign cookie with PHP


Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.