
When you access a website for the first time, GA will generate a pseudorandom ID and store it in your browser cookie. The next time you come back to the website and if the cookie still exists, GA will use it to track you as the "same user".
Imagine you access the same website using:
What is recorded in GA will look something like this (simplified example):
In other words, GA will treat you as three different users. That means by default, GA (or any other browser-side technology) on its own has no ability to track you as the same person as you move across browsers or devices.
The only way to reliably track cross-device activities of a person is by using a unique and persistent first-party user ID. This can be done if the website has user login function.
When the user is logged in on the website (regardless of which device they're using), the website can output a persistent logged-in user ID. This value can then be passed to GA to be used to track the user, in place of the pseudorandom ID.
Using the simplified example above, if the logged-in user ID is ABC123, what is recorded in GA will look something like:
That way, GA will track these activities as coming from the same user (user count = 1), this improving reporting accuracy.
In order to use this feature, the sending of User-ID needs to be consistent throughout all pages.
Imagine a scenario where a user logs out and continue to use your website, what is recorded in GA would look something like this, with the inflated users and sessions count:
For more technical information, please refer to this Google documentation.
Otherwise you would face inflated users and sessions like mentioned above. For this, it is recommended that you:
The value used for the User-ID should be a unique logged-in identifier (hashed if necessary) used by the backend system.
It cannot be something that be can used to identify a person. Examples:
When users are not logged in, do NOT send:
If you do that, GA will treat all non-logged-in users a SINGLE user. You do not want this.
When users are not logged in, it's better to:
The prerequisite is that the website needs to output the unique user ID when the user is logged in.
Once that is done, like mentioned above, there are two recommended ways to implement User-ID:
You can do this in GTAG or Google Tag Manager. You need to pass the logged-in user ID value to the user_id parameter.
Example:
In GTM, you can create a Event Settings variable and set the user_id parameter there.
Example:
Then ensure that all GA event tags are using this variable. Example of a GA event tag:
In GA, in order to make use of the User-ID feature, change the Reporting Identity to either Blended or Observed in:
Admin → Property settings → Data display → Reporting identity
When your User-ID implementation is complete, you can start to:
You may have heard of these two features and wondering what the difference is.
The User-ID is meant for you (first-party) to track logged-in users across devices or browsers, using a unique persistent user identifier defined by you.
User-Provided Data (UPD), also known as Enhanced Conversions, is meant for you and third-party platforms (Google) to do customer matching, using commonly-used identifiers such as email or phone number. This technique is meant to mitigate the loss of cross-network data signals due to the degradation of third-party cookies.
The identifiers used, pre-hashed by you or automatically hashed by Google, can be:
The details of UPD will not be covered in this article.