Do you have a login on your site? Would you like to analyze individual users in-depth in GA4? Well, you can. You can pass your own User IDs to Google Analytics. This way you can form a complete picture of your users. You can track them over different sessions, devices, and platforms. In this article, I will guide you through the process of setting up user IDs for tracking in GA4. Let’s go!
Contents
What can you do with unique User-IDs in GA4?
Once you register user-IDs in GA4 you have many more capabilities to analyse your users granularly. It gives you the opportunity to link all sessions and events to one user and understand them better. In GA4 it specifically allows you to:
Build a comparison of signed-in vs. non-signed-in users
Drill-down in Explorations to analyze individual users
Create remarketing audiences based on User-ID
De-duplicate reporting based on User-ID
Export to BigQuery to see user-level data
You can get very creative with the Explorations you can create with this data. Especially, when you export your data to BigQuery. To understand how it works, we need to have a look at how events get attributed to user-IDs.
What happens with the measured events before a login?
Imagine a users visits the page before creating an account or login in. They navigate on your website creating many different events. At that time they will not be linked to any user-ID, because you have none. This will be the bulk of your events.
Luckily for us, once the user does create an account or logs in, all the events that they created prior to that are linked to the User-ID at moment of log in. This gives you the opportunity to analyse what users do before creating an account for example.
What happens with the measured events after being logged in?
Once a user logs out you will lose the opportunity to link the events to their ID. Problably this will not happen that much anyway.
How to implement tracking of User-IDs in GA4?
So how do you send user-IDs to GA4? It is not that hard but you will need some help. Let’s have a look.
Make User-ID available in the datalayer
a. Via developer:
With the help of your developer you can push the user-ID to the dataLayer of your website. This way you can always grab it and pass it along with your events to GA4. The code below should be added where the user-ID value should be updated dynamically.
Many plugins for GA4 already populate the users ID to the dataLayer automatically. Take the GTM4WP for WordPress plugin. This makes it very easy for you to track your logged in users.
Add a datalayer variable in GTM which grabs the User-ID
Modify your GA4 config tag
a. Add field to set with the key: “user_id”
b. Insert your variable as the value
Test your setup and you are good to go!
Data privacy note: make sure you have the proper consent from your users and treat their PII with care. Also, GA4 does not allow you to send PII. So, the User-IDs cannot be PII like an e-mail. Because of this you should always add your own random ID.
The takeaway
Hopefully you know see the potential benefits of sending user-IDs to GA4. Implementing it should be that hard. But, if you have any issues, feel free to contact us.
By Freek Kampen
Data & Analytics specialist and co-owner of New North Digital. With a background in online advertising, I solve tracking and data issues for entrepreneurs and agencies. Feel free to get in touch!
Add a tool to your comparison list.You can add max 4 items.
Close
Get help
Send us a message
This website uses cookies to improve your experience, personalize content, to provide social media features and to analyze our website traffic. By continuing on this website you consent to the use of cookies.
Settings
Accept
Cookie Settings
Close
We want to be transparent about the data we collect and how we use it, so you can best exercise control over your personal data. For more information, please read our Privacy Policy.
We use this information to improve the experience of our site visitors. This includes improving search results, showing more relevant content and promotional materials, better communication, and improved site performance.
Functional
Functional cookies ensure that our website continues to work properly so that you will see the correct information on our website when you return.
Analytics
We use analytical cookies to see how often our website is visited and, for example, which pages work best for us.
Advertising
We use advertising cookies to measure the performance of our advertisements.