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 that 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:

111872281.191903162.1338926615.1339098439.1339100387.4

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

111872281.2.10.1339100387

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

111872281

__utmv allows you to create custom variables to segment different groups of users and track their behaviors. This cookie is only present if you, as a domain owner create 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 points into your website storing traffic source, medium, campaign, and search term used to land on your website. The cookie value includes Domain hash, current timestamp, session count, and campaign information. The cookie is updated with each page view and expires 6 months from the 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 the history of the 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 the GA campaign cookie in PHP, use the following code.

Retrieve GA campaign cookie with PHP

Share this post

Comments (0)

    No comment

Leave a comment

All comments are moderated. Spammy and bot submitted comments are deleted. Please submit the comments that are helpful to others, and we'll approve your comments. A comment that includes outbound link will only be approved if the content is relevant to the topic, and has some value to our readers.


Login To Post Comment