I love adding a bit of magic to the workflow. I think it makes it more exciting and special. This is why I believe that GA4 is a new galaxy, and we are brave explorers.
Every day is a new adventure, as we are exploring new features that are being rolled out.
There is a common statement that GA4 is an upgrade of UA. Well, it is partially true, but at the same time, I would say that this is an entirely new tool with the new data model. It can be challenging but fun as well.
GA4 has changed drastically, and this is why it is fundamental to perceive it with an open mind. It is important to work with new features without constantly comparing GA4 to UA, as 1-to-1 migration would never be possible.
It might seem very daunting and frustrating because the sunset of UA is too hasty.
🚨 Note: If you’re struggling with switching over to GA4, check out our handy GA4 migration guide, which is explained in 11 steps.
There are many things we have to learn from scratch, we will focus on one of the features in this post. Specifically, we will discuss how data is collected and focus on User ID in Google Analytics 4.
Here’s the outline of what we’ll cover:
- Data Collection in GA4
- GA4 Reporting Identity
- User ID Implementation with GTM
- Verifying Your Setup
- How to work with the User ID
- Some Important Tips
Data Collection in GA4
How are your users tracked in GA4? How do you collect data about your users in GA4?
The standard way of collecting data in UA is rather limited.
For example, let’s say you have a user with multiple devices. A guy or girl wakes up in the morning checks his or her phone and visits your website.
Then this person goes to work, opens a new tab, and continues browsing your page on the laptop.
Later, this person goes back home and uses a tablet to continue exploring your website.
Therefore, this is a single-user journey on your website, however, due to the cookie limitations, UA would display three different sessions.
This would happen with the help of a client ID. It is a unique, randomly generated string that serves as an identifier and anonymously identifies a browser instance.
In this way, Analytics can identify your users, as their client ID gets stored in the browser cookies, so that all their subsequent visits to your website can be associated with the same user.
However, a client ID is limited, as it is basically related to your user’s device.
You might wonder what the solution could be in this case. This is where the beauty of GA4 comes in. One of the greatest steps forward with this tool is its cross-device tracking.
So now it is possible to track your users across multiple devices with GA4.
GA4 Reporting Identity
In the Admin panel, there is a section called Reporting Identity. This is where you can choose how to collect the data about your users.
Specifically, GA4 offers four different methods to unify a single cross-device user journey:
- User ID
- Google signals
- Device ID
We have three reporting identity options here.
The first option is blended. It relies on the User ID if you have this feature.
If no User ID is collected, then Analytics falls back on Google signals if this option is enabled.
However, if neither User-ID nor Google-signals are available, then Analytics uses the Device ID. If this option is not available, GA4 would use modeling.
The second option (observed) uses the user ID, and if it is unavailable, GA4 takes information from Google signals. If both are unavailable, GA4 uses the device ID.
The last option is device-based, using only the device ID, ignoring other collection methods.
Now you have an idea of how users are tracked in GA4, and we can focus on User ID in Google Analytics 4. What is it about, and is it the same as a Client ID?
So, let’s say you have a website where users can log in, providing their credentials.
This is how the system knows that this is the same user when they browse your website.
In this case, even if a user visits your website with multiple devices, GA4 can perceive that this is a single journey.
However, it is essential to understand that this option is available for websites or applications where you have some identification method.
As discussed, if a User ID is not available as well as Google signals, a Device ID is used. This is the previously known Client ID in Universal Analytics or the so-called user pseudo ID.
This method is exactly like the standard way of tracking users in Universal Analytics, as the system would recognize a device only in this case.
Therefore, this is the least reliable and the least precise method due to the inability to identify a cross-device journey.
User ID Implementation with GTM
As the User ID is not available by default in GA4, it has to be implemented on your own. In this article, we will cover its implementation with the help of Google Tag Manager.
When we preview our GTM container and log into our system, we can see a custom event called userLogin. It fires each time a user provides their credentials to access our platform.
If we extend the API Call, we can see the information about our user, specifically a user ID as well as a loyalty tier.
It is important to understand that this must be set up additionally. In our case, the data about users from our CRM system is pushed into the data layer.
To be able to get this data, you might need to ask your developer to create a data layer for you, or you could also use a plugin if there is any available. This step depends entirely on your website specifics and must be addressed specifically.
The first thing you need to set up in GTM is a variable that would store the value of our user ID. You should go to your GTM account and click Variables → New.
Now, we should click on Variable Configuration.
We are working with the data layer, and this is why we should select a Data Layer Variable.
We should provide the same name as you have in your data layer. In our case, we already checked it in the preview mode and found that it is user_id.
Now our variable is set up and ready to be used. Let’s save it and open our GA4 Configuration Tag. Under Fields to Set, you should provide a field name user_id and select our variable as a value.
This is the whole setup. It is not that complicated, right?
However, there are some crucial aspects to keep in mind.
As you can see, my custom event fires before the Analytics tag, as I want to have my user data available before Analytics is loaded.
Therefore, you should make sure that your data layer is implemented correctly, as the order is crucial here.
Another important thing: You should not create any value in the data layer for users who are not logged in.
It might be tempting to create a default value like unknown, but it might break the implementation. Thus, you should not set up any value if a User ID is unavailable.
Verifying Your Setup
Here comes the most exciting part – testing. Let’s preview our GTM container again and also log into our system.
Navigate to your GA4 property and click Configure → DebugView.
If you see the orange text here, you’ve set up everything correctly.
If you click on any event after your login, you should see your user_id property under User Properties.
How to work with the User ID
Now comes the most important question: Where can I see my User ID after it has been implemented?
There is a dedicated exploration for that called User Exploration. You can find it by clicking Explore on the left side.
Here you can see the values of App Instance ID.
Note that it is the same name for both websites and applications. You can see this long number with a dot that is a user pseudo ID, and the User ID we configured.
If you click on the User ID, you can have an overview of this user’s activity on your website.
What if we want to see this User ID in different custom reports? One of the options could be to set up a separate custom parameter for that.
Is this a good solution? Well, this is a philosophical question, since you might face some cardinality issues in this case.
Another way to use this feature is to create a comparison in the reports section. In this way, you can make a quick analysis, comparing all users against logged-in users.
To do that, you should provide a condition that Signed in with user ID equals true and then click Apply.
Some Important Tips
There are a few things you should keep in mind when it comes to User ID implementation.
2. The User IDs you configure must not exceed 256 characters.
3. Data you collect will start getting associated with a user ID only AFTER your implementation.
GA4 offers a powerful feature that can help you to dive deeper into the analysis. It is only available when you have some user identification method.
The User ID in Google Analytics 4 allows you to associate your own identifiers with individual users so that you can build a comprehensive picture of your user journey across devices.
In this way, you can achieve more accurate numbers in your reports, and get a holistic story about people’s engagement with your website.
If you want to ensure that your analytics setup is efficient enough, check out our handy GA4 audit guide.
Have you already implemented this feature in your GA4? Did you set up an additional parameter to use as a dimension in your various explorations? Please share your experience in the comment section.