I LOVE chocolate-chip cookies. Sweet and warm– fresh out of the oven– with gooey chocolate that just melts away with every bite. However, this post is nothing about that.
Cookies, in computer world, are very small text files which are used to store important information. Cookies can store this information for any specific period of time– from 1 millisecond to many years– and this makes cookies all the more desirable. However, everything has its own limitations; cookies are browser specific, their size with contents must not exceed 4kb limit, and they can be deleted by a user through browser settings.
Cookies are at the heart of any analytics service. Google Analytics, too, depends heavily on cookies to track users– and more. Find out how cookies work in Visitor Identification and their limitations you need to keep in mind by clicking here. Their usage has changed drastically since newer version called ‘Universal Analytics’ was introduced. Here are the cookies used in Universal Analytics: _ga cookie, _gid cookie, and _gat cookie
|_ga||2 years||Visitor identification|
|_gid||24 hours||User journey|
|_gat||10 minutes||Throttling request rate|
I.) _ga cookie
Here is what it will look like: _ga = GA1.2.1673464361.1560021040
_ga cookie is the centerpiece among all Google Analytics cookies. It is used for Visitor Tracking.
This cookie contains 4 types of information separated by a dot (.):
- “GA1”, here, stands for the version of the code and cookie. It only changes on major upgrades from google.
- “2” signifies that the cookie is created on top level domain. If the number is 3+, it means that the cookies are created on subdomain level.
For example: in URL, “xyz.abc.com,” abc.com is the top level domain, and xyz is its subdomain. If a cookie is created at a top-level domain, one user will be considered as only one on all of its subdomains, however if cookies are created on subdomain level, one user will be considered as different users for different subdomains. By default, Google creates cookies on top level domain.
- “1673464361” is a random number generated by Google when this cookie was created and stored in it, and
- the last one “1560021040” is the timestamp of when this cookie was created after this user arrived on site the first time.
Combination of this random number and timestamp (3. & 4.) makes up for a very unique number, and it is used as the Client ID to identify visitors/users.
PRO TIP :You can retrieve Client ID from this cookie in case you wish to track these and pass them in Google Analytics through Custom Dimensions
II.) _gid cookie
This cookie is used to group the user behavior together for each user. Structure of its value is very similar to _ga cookie. You can examine it by using document.cookie command. It expires after 24 hours of inactivity.
Here is what it looks like: _gid = GA1.2.1991051347.1560021040
_gid cookie is responsible for tracking user behavior. It expires after 24 hours of inactivity.
The contents of this cookie are also very similar to _ga cookie, and it contains 4 types of information:
- “GA1”, stands for the cookie version.
- “2” stands for top level domain.
- “1991051347″ is a random number generated for the current session, and
- the last one “1560021040”is the timestamp of when this cookie was created.
III.) _gat cookie
This cookie is used for throttling requests to Google Analytics to increase the efficiency of network calls. When you are using doubleclick on your site or you have demographic/interest reports enabled, then your browser will also send hits to Google doubleclick. To limit the requests being sent from your browser to Google doubleclick, this cookie is created. It makes sure that doubleclick doesn’t get choked by too many requests.
Here is what it looks like: _gat_UA-XXXXXX-1=1
_gat cookie is used for throttling analytics requests to Google Analytics servers.
HEADS UP !UA-XXXXXX-1 in the cookie name will be your Tracking ID / Property Number. I have X’ed it out. Its value is 1, and it means that it is on.
Conclusion & Summary
Google Analytics uses _ga, _gid, & _gat cookies for their internal usage. Google Analytics identifies visitor through _ga cookie & it understands user journey through _gid cookie. _gat cookie is used for throttling analytics requests to limit requests being sent from your browser to Google services.
Did I miss something? Do you have anything to share/ask? Leave your comments below.