
You should set user_id field in the GA4 config tag (but then make sure that all other event tags are using that config tag). You need to send user_id with every event to GA4 (when user_id is available). If you want to track a single user journey in GA4, you will have to use the same GA4 property (even if that means sending data from multiple websites to the same property).

User ID can’t be merged across GA4 properties. The maximum length of the user ID that you can send to Google Analytics 4 is 256 Unicode characters. So, the events that happen before the user ID is sent to GA4 during the same session will get the user ID too. a page_view (without a user ID), then logs in during the same session, user ID will be automatically applied to page_view too.
#REMOVE RAW STORY TRACKER HOW TO#
You could do some magic with BigQuery if you know how to work with it, but there is no automatic user reverse-stitching.īut on the other hand, if a visitor does event 1, e.g. However, user ID is not automatically applied to all those past sessions. If after several sessions, that same user decides to register on your website, he/she gets a user ID. This client ID is then used on every page. When a new visitor lands on your website, Google Analytics 4 stores a cookie with a randomly generated ID (this is NOT a user ID). Historical data. User ID is not applied to historical data that goes beyond the scope of the same session. Historical data, User ID length, and other quick tipsīefore we get the user ID, here are several more tips and gotchas.

5239asbd923fade923da – CANbe used as a User ID in Google Analytics.– CANNOTbe used as a User ID in Google Analytics.Kind of a gray area but the industry aligns with it. These are acceptable User IDs that you can use in Google Analytics.īut you might say Hey, aren’t such IDs still PII? I can look that ID up in my CRM and still identify the visitor. However, you can still use a less readable User ID from your system (that consists of random numbers, letters, etc.) e.g. Even if you use email addresses to identify users in your system/CRM/etc., you cannot use email as a User ID in GA. The same principle applies to the User ID. It’s really important to understand that Google Analytics’ Terms of Services do not allow tracking PII (Personally Identifiable Information), such as Email Address, Social Security Numbers, etc. Not everything can be a User ID in Google Analytics In the upcoming several chapters of this blog post, I will explain them.īut before that, I want to share several important things. There are several possible options and they depend on how your website is coded. Now you might be wondering: where and how can I get that user_id? But once the user logs in to his/her account on your website, the ID should become available, and then the next time this GA4 config tag fires, it should also contain the user_id. If a user is browsing your website anonymously (read not logged in), that variable will return undefined, therefore, the user_id will not be sent to GA4. Then you will need to enter the value (a variable that contains the actual ID of the visitor who has logged in to your site). In that tag, you should click on Fields to Set > Add Row and enter user_id (see the screenshot below): If you have no idea what it is, read this. In GTM, you must already have a Google Analytics 4 configuration tag. And, if you already know me, I will be explaining how to do this with Google Tag Manager. How to send user ID to Google Analytics 4? With Google Analytics 4, thankfully, that is no longer needed. If you wanted to adopt user ID tracking in GA3 (Universal Analytics), you had to create a separate User ID view and that data was available only there. Improvement (compared to Universal Analytics) Later in this blog post, I will show you how to send that ID to Google Analytics 4. This means, that once a visitor/user accesses his/her account, you have its ID in your database. The count of users will be more accurate (because if the same user uses multiple devices, you will see one user instead of multiple).īut I can’t emphasize this enough: user ID will work for your business well if a visitor can log in to your website/app. You will see those users in the user explorer too:

The example below is not the best one but that’s the quickest one I had:īut that’s the reality when the majority of your traffic is coming to anonymously read content (and not log in to accounts). You will be able to see how users are using different devices. When you send and ID Google Analytics and related data from multiple sessions/devices, your reports tell a more unified, holistic story about a user’s relationship with your business.

User-ID lets you associate a persistent ID of a single user with that user’s engagement data from one or more sessions initiated from one or more devices (and, of course, browsers). What is the User ID feature in Google Analytics?
