How to Set Up GA4 User ID Tracking 

When a new user goes to your website, GA4 generates a cookie-based anonymous ID for that user. That ID is used for identifying a specific browser on a specific device, or an app instance. With this, users cannot be identified across browsers, devices, or platforms.

For example, a new user could visit a website using a specific browser and visit the website at another time through another browser or device. These will be recorded as different users, as all the IDs created, would not be tied to the same user.

The GA4 User ID helps with dealing with the limitation of the above method. The User ID feature is a cross-device and cross-platform tracking feature in GA4 for user identification.

This article describes how to configure User ID tracking in Google Analytics 4 to improve the quality of user identification using Google Tag Manager (GTM) or GTAG.js

What are user_pseudo_id, App-instance ID, and User ID in Google Analytics 4?

Several IDs are collected by GA4 for user identification, it is important to know each of them and how they are collected in order to use them appropriately.

When a user goes to your website unauthenticated, GA4 generates a user_pseudo_id based on a cookie stored on the user end, this ID is used to identify a specific user for the same browser on a specific device. Each time the user uses that same browser on that same device that user_pseudo_id will be associated with all its recorded events. If the same user uses a new device to visit the website, a new user_pseudo_id will be generated for that user. This used to be called Client ID in Universal Analytics.

The App-instance ID is the ID associated with a device for each instance of an app. The App-instance ID is the user_pseudo_id for an app. App-instance ID is used in GA4 report interface while user_pseudo_id is used in BigQuery.

The User ID is a custom identity ID for each signed on user on your application or website.

In GA4 you can assign a unique User ID to your website or application visitors, which enables you to identify each user across multiple sessions, devices, platforms, or browsers. 

This can only be possible if your website or app has a user authentication system. With this, you would be able to connect multiple devices, sessions to a specific user.

If you are yet to set up GA4, you can use these articles GA4 set up and GA4 set up for SaaS as guides to do so.

Why you should send user_id in GA4

Unlike user_pseudo_ids that are automatically generated in GA4, User IDs are not generated in GA4, you have to create the User ID and assign it to your users by using your user authentication system. You could use the unique details such as emails collected at the point of sign up to your platform to assign a custom ID which you can then send to GA4 for user identification. The User ID is then associated with multiple browsers, devices, or sessions which in turn helps in unifying a user’s journey across your website or application.

In GA4 four methods can be used to identify users and collect associated data, they include:

1. User ID 

The user identification ID you create with the use of your user authentication system for each signed on user on your platform.

2. Google Signals 

Google signals gets data about your users who are signed on to their Google accounts and have consented to having their information shared. To learn how to set up Google signals in GA4 please check out this detailed article.

3. Device ID 

This is the device ID associated with a device being used on your website or application. The device ID is the client ID for websites. On apps, the device ID is the app-instance ID.

4. Modelling 

Google uses machine learning to estimate user data of users who decline analytics identifiers. The data of users from the same GA4 property who have accepted these identifiers is used in modelling the missing data.

Your GA4 Reporting Identity is any of the methods discussed above being used by your property for data collection and for identifying your website or app users. There are three reporting identity options to choose from. You can find this set up in the admin section of GA4. Let’s look at these options in detail.

Reporting Identity in Google Analytics 4
Reporting Identity in Google Analytics 4
  1. Blended: This uses the first available method by their order of preference. It uses the user ID if it is collected. If user ID is not collected, it uses information from Google signals if that is available. If Google-signals is also not available, then it uses the device ID. If none of the above methods are available, then it uses modelling.
  1. Observed: It uses the user ID if it is collected. If no ID is not collected, it uses information from Google signals if that is available. If Google-signals is also not available, then it uses the device ID.
  1. Device based: It uses only the device ID irrespective of the availability of all other IDs that are collected.

What can be used for User ID value in GA4

The User ID you assign to a user should be fewer than 256 characters and could be a combination of numbers and alphabets.

It should not contain information that a third party could use to determine a user’s identity, as such Personal Identifiable information’s (PII) such as email addresses, social security numbers, names, should be avoided. This is in accordance with Google’s Terms of service. Users are also to be informed on how you use the identifiers. Please see Google’s Terms of Service for further details. You can also check this article to learn how GA4 is GDPR compliant, GDPR is one of the standards that dictates how private data should be protected.

Don’t create custom dimensions for User ID

Google recommends not creating custom dimensions for User ID. This is because the number of possible unique values for User ID could be over 500 unique values in one day. This would lead to an increased number of rows in a report that could likely exceed the row limit causing values beyond the limit to be aggregated into a single row, the (other) row.

How to set up GA4 User ID Tracking

There are several methods to set up GA4 User ID tracking, but we will cover two methods in this article, setting up GA4 User ID tracking by using Google Tag Manager (GTM) and by using GTAG.

Configuring User ID using GTM

Here are the steps for configuring User ID with GTM:

  1. Push the User ID to the Data Layer

    Once your development team have set up a system to generate IDs for signed on users, ask the team to push the User ID to the Data layer with the code below.
    “USER_ID” is a dynamic variable that stores a unique ID for every user. 
    Screenshot of code to push user id

  2. Create a data layer variable

    A data layer variable has to be created in GTM to store the value of the User ID from the data layer in GTM.
    1. To create a variable, go to your GTM account, click on Variables, and select new under User-Defined Variables.
    2. This opens the variable configuration setting, where you get to choose the Data Layer variable.
    3. Create a name for the variable and then save it. Create data layer variable "user_id" - step 4

  3. Send the user ID to Google Analytics 4

    To send the data layer variable that you have created from GTM to GA4, you need to set the User ID in your global configuration tag.
    Open your main configuration tag, under the Field to set section add user_id in the field name and then select the variable created above as the value.
    How to send the user ID to Google Analytics 4

You can check if your setup is working properly by using the debug view in GA4.

Setting up User ID using GTAG

To set the User ID with gtag.js, update the Config for your property with the code below:

gtag('config', 'GA4_Measurement_ID', {
  'user_id': 'USER_ID'

To learn how to use GTAG for GA4 please check this article.

GA4 User ID Report or where to find User ID in GA4

After setting up your User ID, the data will appear in GA4 after 24 hours. You can find the User ID in the User Explorer report which is one of the GA4 Exploration report templates

To create a User Explorer report simply navigate to GA4 Explore, select the Template gallery, and click on the “User Explorer” template.

The User Exploration report can be used to explore the behaviour of groups of individual or specific users. When you create a User Explorer report, GA4 shows you a default view of the User Id against some metrics. Here, it is called the App Instance ID for both website and application users. This field shows the user_pseudo_Id or User ID if available for a user. The user_pseudo_id can be identified as the IDs with dot while the User ID can be identified with the format you used in creating them.

GA4 User Explorer User ID Report
GA4 User Explorer User ID Report

GA4 User explorer report doesn’t allow full access to your data except by using a custom dimension and it is not advisable to create a custom dimension with User ID. You can access the entire user’s data by connecting GA4 with BigQuery without having to create the custom dimension. Writing SQL statements in BigQuery to get the data for you in Google Looker Studio will enable you to see all the events and parameters.

User ID limitations in GA4 Explore Reports

The limitations of User ID in GA4 explore reports is due to Personal Identifiable Information (PII) requirements. Data about users demographics, age, and interests cannot be viewed in GA4 explore reports. Real time view of User ID data is also not available.

Final Word

User ID in GA4 is a custom ID you assign to signed on users on your website or application. It can only be used for platforms that allow user authentication.

With it, you get a more accurate count of unique users, you will be able to align the User IDs in GA4 to the User IDs in your database or CRM allowing you to create a more in-depth analysis that would help you gain a more holistic view of your user’s journey across different platforms, browsers, and devices.

It is key to note that data collected prior to User ID implementation won’t be reprocessed and associated with a user ID. Also, the User-ID data collected in one GA4 property cannot be shared with the User ID data in other properties.

Frequently Asked Questions

What is GA4 User ID?

The User ID feature is a cross device and cross platform measuring feature in GA4 for user identification.

What are the benefits of User ID in GA4?

With User ID you can track your users and their activities across multiple devices, sessions, and platforms. It gives a holistic view of your user’s journey and provides accurate data about your users that can be used for segmentation and retargeting. With it you have a shared identity with the dataset in your database or CRM.

How do I set up User ID in GA4?

You can set up User ID in GA4 by using GTM or GTAG.js

What’s user_pseudo_id in BigQuery?

The user_pseudo_id in BigQuery is the ID generated by GA4 for every new visit based on the cookies on the user end. You can get this in BigQuery when you link your GA4 property to BigQuery.

Leave a comment

Your email address will not be published. Required fields are marked *