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.
What is a Cookie?
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.
Limitations of using cookies for Visitor Tracking
Using cookies is a great option to track various things over the web. However, everything comes with its own set of limitations. Here are some limitations of this method you need to know:
- Cookies can be deleted.
This one is a no-brainer. Visitor can delete cookies through browser settings. Once GA cookies are deleted, even the same user will never get the same “Client ID” again. Therefore, he will be considered as a new visitor. This may inflate visitors.
- Cookies are browser-specific.
However, this also means that one browser cannot access another browser’s cookies. So, if a user accesses your website through Chrome as well as Firefox, the same user will be considered as 2 different users.
- Incognito Mode.
Incognito Mode is available for most browsers, and it is used widely. Don’t know what it is? Click here to find out. Incognito Mode and Normal Browser work just like two different browsers. So, if one user is using both of these browsers, he/she will be counted twice.
Moreover, there is one more interesting aspect of Incognito Mode. When a user closes all the tabs/instances of Incognito Mode, it automatically deletes all cookies stored. Hence, the same user may be considered as a new user everyday if this user accesses your website through incognito mode only and he closes all tabs everyday as well.
“Cookies” have a few limitations that may cause over-reporting in numbers
Summary & Conclusion
- Google Analytics uses _ga, _gid, & _gat cookies for their internal usage.
- Google Analytics identifies visitor through _ga cookie.
- GA 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.
- Cookies have a few limitations that may cause over-reporting in the number of users.
Share this article with your friends & colleagues and spread the joy of learning!
Did I miss something? Do you have anything to share/ask? Leave your comments below.