GA4 User ID For Cross-Device, and Platform Tracking across Sessions

The User-ID feature in GA4 allows you to pass in your own identifier for individual users so you can connect users' behavior across sessions, devices, and platforms.

This user id is an id that you provide to

Using this User-ID GA4 which provides you with a more accurate user count.

What Do You Need To Activate User-ID Tracking

  1. A way for you to create a user id -  You need to create a unique ID for each user on your own and assign and consistently reassign the IDs to your users. Generally any site that has login functionality will have this id stored in the data layer, cookie, local or session id, or global JavaScript variable.
  2. Send the user_id to GA4

 

How to send User ID to GA4

On page code

gtag('config', 'Tag ID', { 'user_id': 'USER_ID' });

Google Tag Manager

Pull the user id from the data layer, cookie, session storage, etc. to a Google Tag Manager variable.


  1. In Google Tag Manager, click Variables.
  2. In the User-Defined Variables section, click New.
  3. Click Variable Configuration
  4. Use the variable that will pull the data.
  5. Click Save.

If you are not familiar with how to use Google Tag Manager, then feel free to reach out to us at support@optizent.com

Modify the GA Configuration Tag

  1. In Google Tag Manager, click Tags.
  2. Select your Google Analytics 4 Configuration tag and click on Edit
  3. Click Fields to Set to expand that section
  4. Click Add Row.
  5. In the Field Name field, enter "user_id" (note user_id has to be typed as is)
  6. In the Value field, select the variable that you created to pull the user_id
  7. Click Save.
  8. Click Submit to publish the changes.

 

How to use User-ID in GA4

Signed-in with non-signed-in users - Create an exploration to see signed-in v/s not-sigend in users

User exploration - Create user exploration to drill down into the signed-in users.

Remarketing audiences based on User-ID data

You can create remarketing audiences based on user IDs that you pass to GA4. By linking Google Analytics and Google Ads accounts, these audiences will be available in your shared library in Google Ads.

How GA4 handles sessions with User-ID

If a user trigger events on your site or app before a user_id is assigned then analytics uses the session ID to associate that session with the user ID provided when the user_id is assigned.  So all previous events will be assigned to that user_id.

However, any events by the user after the user_id is no longer associated will not be attributed to that user.

Here is an example from Google that should clarify it:

A user starts a session with no associated user ID and triggers Events A and Event B. No user ID is associated with those events. The user then signs in and triggers Event C. Events A, B and C are now all associated with that user's ID. The user finally signs out and then triggers Event D. No user ID is associated with Event D. Events a, B and C still remain associated with that user.

Things to Keep in Mind

  • User IDs must be fewer than 256 characters long.
  • User ID is not retroactive. This means it will be only applied going forward and not to the past data.
  • You can not use PII data such as email or phone number as a user ID

User-ID as a Custom dimension

One of the things you might be tempted to do is to use User-ID as a custom dimension. However, that's not possible.  User-ID is not part of the user properties so you can't create a custom dimension from it.

If you do want to use it as a custom dimension then you will have to pass it as a user property with a different name since user_id is a reserved name.

Keep in mind that using user_id as a user_property is not recommended since it will likely have more than 500 unique values in a day.  As per Google

 A dimension is considered high-cardinality when it has more than 500 unique values in one day. High-cardinality dimensions make it more likely that a report hits its row limit, resulting in the "(other)" row. You should use high-cardinality dimensions only for information that's important and necessary to meet your business goals.

So if possible avoid passing user_id as a user property.

 

Other Google Analytics 4 posts that you might be interested in

  1. What is Google Analytics 4 (GA4)?
  2. 10 Key Things to Know Before Upgrading to Google Analytics 4
  3. Bounce Rate in Google Analytics 4

 

Google Analytics 4 (GA4) online courses

We have several Google Analytics 4 courses to help you learn at your own pace.  These GA courses cover Reporting, Analytics, Administration, and Implementation. Check out GA4 Courses on Optizent Academy.

Need Help with Google Analytics 4?

We provide Google Analytics 4 consulting and training services. We can set up Google Analytics 4 as well as train your team to be self-sufficient. Contact us for a no-obligation consultation.

Leave a Reply

Your email address will not be published.