Google Analytics keeps track of website visitors as users, and it uses the Client ID stored in the browser cookie to determine it. Google Analytics stores _ga cookie in the user's browser and the browser sends cookie data to a web server every time it makes a request. To view your Google Analytics (GA) cookie for a specific site, you may use developer tools available on your browser to view them. For example, on Google Chrome you may click the F12 key -> Applications Tab -> Cookies to view them. An example of "_ga" cookie looks like below:
The _ga cookie value has 4 segments each separated by a period. Each segment has following values.
- GA1: GA1 is the prefix used with _ga cookie.
- 2: The number 2 indicates the level of domain, in this case second-level domain.
- Random Number: The random number is the first-part of the client ID.
- UNIX Timestamp: The UNIX timestamp is the date/time when the Client ID is created.
The third and 4th segments make up a client ID. In the above example, the Client ID is "468604437.1611708469" without the enclosing quotes. The _ga cookie is good for 2-years, and every time a user is revisiting the target website, the _ga cookie is renewed to stay for 2-years from the last visit. For a new visit, a new Client ID is created in the user's cookie and for returning visit the existing client ID is identified. The use of the client ID to track new and returning users is not 100% accurate since (1) the browser cookie can be deleted by a user, (2) a user may use a different device to access the target site, and (3) a user may use a different browser to access the target site.
To illustrate this further, the following scenario holds true:
- John Doe at work uses a Chrome browser on Windows PC to access a target website for the first time. A new _ga cookie is created on Chrome Browser on Windows PC, and GA will make this a "new" user.
- John uses a Safari browser on his iPhone to access the same target website during lunchtime. A new _ga cookie is created on Safari browser on his iPhone, and GA will make this a "new" user again.
- John goes home and uses a Chrome browser on his Macbook to access the target website. A new _ga cookie is created on Chrome browser on his Macbook, and once again GA will make this a "new" user.
- Later that night, John uses Firefox browser on his Macbook to access the same website. A new _ga cookie is created on Firefox browser on his Macbook, and GA will make this a "new" user again.
Even though John Doe accessed the same website 4 times using different browser-device pair, and GA mark them all new users as GA has no way of knowing they are the same user. This is the limitation of how "new" and "returning" users are tracked in Google Analytics. To work around this problem, GA introduced User ID to help identify the same user by allowing a website to send the user-specific identifier to the GA. This is another subject that we can discuss later, and it involves some programming effort by the web application to tag unique IDs with a session.
The purpose of using a Client ID in Google Analytics is to identify unique visitors and determine if a user is new or returning. As client ID is only unique within browser-device pair, and because the cookie can be deleted by the visitor; the new and returning users seen in GA are not 100% accurate. Regardless, Client ID can be used to identify your website users and use them as a marketing tool to analyze user's behaviors on your website.
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.