Understanding Google Analytics Cookies
Cookie Tracking in Google Analytics Explained
Cookies are used to store user information in a browser for the activities done on a website. Once the cookies are stored, the browser remembers it and suggests the domain name and URL when you start typing in a new window.
The cookies are also the catalyst behind opening a logged-in session when you open a new tab or window. These are browser-specific, which means the cookies stored in Chrome wouldn’t work in Firefox and other browsers.
How Does Google Analytics Track Cookies?
Google Analytics uses _ga cookie to store the user information, like browser and device used. A Client ID is assigned to the user in the background to remember the information.
When you browse a website, the GA tracking code starts executing Client ID to track the activities done on the site. For returning users, the same Client ID is used. This is how Google Analytics differentiates between new and returning users.
The actions taken by the user on the website are called Hits. These Hits are saved in GA specifically for every page.
The _ga cookies remain stored in the browser for two years of inactivity.
Types of Google Analytics Cookies
Google Analytics uses different types of cookies to distinguish users and throttle the request rate.
-
_ga
These cookies are used to distinguish users and remain stored for two years.
-
_gid
This is very similar to _ga cookies, but lasts only for 24 hours.
-
_gat
The role of this cookie is to throttle the request rate. It lasts for only a minute.
-
AMP_TOKEN
This cookie can remain stored for up to one year. Its role is to retrieve Client IDs from the AMP Client ID service.
-
_gac_<property-id>
It saves the campaign-related information for the visitor. This cookie is used when Google Analytics and Google Ads are connected. It lasts for 90 days.
-
_utma
It is used to identify users and their sessions. Like _ga, it also lasts for 2 years.
-
_utmt
It remains in the browser only for 10 minutes. The role is to throttle the request rate.
-
_utmb
This cookie determines the new sessions and visits and lasts for 30 minutes.
-
_utmc
As soon as the browser session ends, this cookie gets cleared. It works in conjunction with _utmb to determine whether it was a new session.
-
_utmz
The timeframe for this cookie is 6 months. Its role is to store sources of traffic or campaign.
-
_utmv
It stores visitor-level custom variable information for two years.
The other cookies used in Google Analytics include:
-
_utmx
-
_utmxx
-
_gaexp
-
_opt_awcid
-
_opt_awgid
-
_opt_awmid
-
_opt_awkid
-
_opt_utmc
Not all the cookies mentioned here are used at once. This depends on the JavaScript library and the code used by the website and Google Analytics.