This article is about Google Analytics 4 properties. If you're using a Universal Analytics property, refer to the Universal Analytics section of this help center.

[GA4] User-ID for cross-platform analysis

Send the user IDs generated by your business to your Analytics property
Looking for information about where to find your Measurement ID to start collecting data from your website? Go here instead.

To measure user sessions and activities across multiple devices and platforms, you can implement the User-ID feature. To do this, you'll send Analytics a unique ID that you assign to each of your signed-in users. With User-ID, you can get a more accurate user count, analyze the signed-in user experience, and understand user behavior across multiple touchpoints.

For example, if you have both a website and an app, and your mobile users visit the app using both phones and tablets, User-ID lets you measure and explore those user journeys in a single unified view of the data.

In this article:

Implement User-ID

To implement User-ID:

  1. Generate user IDs in your site and/or app.
  2. Send user IDs to Google Analytics.
  3. Make sure your Google Analytics property's reporting identity uses User-ID.

1) Generate user IDs

Generating unique, anonymous IDs is typically done via your website or app login process. This process needs to uniquely identify your users and then anonymize that information.

2) Send user IDs to Google Analytics

How you pass the anonymized user IDs to Google Analytics depends on whether the data is coming from a website or app, and if an app, whether it's iOS or Android.

For websites, you can use the global site tag (gtag.js) JavaScript library or Google Tag Manager.

gtag.js example

    gtag('config', 'G-XXXXXXXX', {'user_id': 'USER_ID'});
    gtag('set', 'user_properties', { 'crm_id' : 'USER_ID' });

In this example, USER_ID represents a non-personally identifiable user ID generated by your site or app.

The gtag('config' method  passes the user ID to the Google Analytics 4 property for use in cross-device reporting.  Replace 'G-XXXXXXXX' with your measurement ID.

The gtag('set', method  assigns the user ID to a user property for use in reporting and explorations.

Learn more about cookies and setting the user ID.

Google Tag manager example

Using the Google Analytics 4 Configuration tag, create a user_id field that gets its value from a Tag Manager Variable that returns the user ID.

iOS and Android

To implement User-ID in your app via the SDK, follow the instructions for iOS or Android.

3) Check the default reporting identity

Make sure that your GA4 property is using a reporting identity that includes the User-ID option:

  1. Sign in to Google Analytics.
  2. Click Admin, and navigate to the property you want to edit.
  3. In the Property column, click Default Reporting Identity.
  4. Select either By User-ID, Google signals, then device or By User-ID and device.

Learn more about reporting identity.

What you can do with User-ID

Compare signed in with non-signed in users

Once you begin associating pages and events with user IDs, you can compare the behavior of signed in versus non-signed in users:

A comparison including the "Signed in with user ID" dimension and dimension value = yes

Report showing Users, New Users, Engagement Time, and Revenue for signed-in vs. non-signed-in users.

Learn more about building comparisons.

See user IDs in reports and explorations

user_id is a reserved property name, so you can't directly access it in reports and explorations. Instead, you can send the user identifier you create using a different parameter (for example, crm_id), then store that parameter in a custom dimension with a user scoped property:

To send the user identifier to your GA4 property, use the example shown previously:

    gtag('set', 'user_properties', { 'crm_id' : 'USER_ID' });
Then store the user IDs in a custom dimension:
  1. In the left navigation, click Configure, then click Custom definitions.
  2. On the right, click Create custom dimensions.
  3. Enter a dimension name (for example, "User ID").
  4. Select User scope.
  5. Provide a description (optional).
  6. Enter a name for the User property (for example, "crm_id").
  7. Click Save.

Creating a custom dimension named UserID, with scope User, with user property = crm_id.

You can now add this dimension to reports and explorations like any other field.

Learn more about custom dimensions.

User exploration

The user exploration displays the users who make up an existing segment, or who make up the temporary segment that results from using other Explorations techniques. You can drill down into the list to see detailed information about individual users, including how and when that user was acquired, summary metrics for that user, and a timeline of their activities on your site or app.

Learn more about user explorations.

Create remarketing audiences based on User-ID data

You can create remarketing audiences based on user IDs. If you've linked your Google Analytics and Ads accounts, these audiences are available in your shared library in Google Ads.

If you are using User-ID, then Analytics only includes the user identifier and the device identifier for the last device associated with each logged-in user.

If you're not using User-ID, Analytics includes all device and user identifiers in the audience information it exports to Ads.

Learn more about creating and editing audiences.

How Analytics handles sessions with incomplete User-ID collection

Users sometimes trigger events on your site or app before signing in or after signing out. In the first instance, Analytics uses the session ID to associate that session with the user ID provided when the user signs in. In the second instance, once a user signs out, Analytics stops associating any subsequent events with that user ID.


A user starts a session with no associated user ID, and triggers Events 1 and 2. No user ID is associated with those events.

Next, the user signs in and triggers Event 3. Events 1,2, and 3 are now all associated with that user's ID.

Finally, the user signs out, and then triggers Event 4. No use ID is associated with Event 4. Events 1, 2, and 3 remain associated with that user.

Limits of User-ID

Guidelines and policies apply

The User-ID feature is built for use with Google Analytics technologies. All implementations must comply with the Analytics SDK / User-ID Feature Policy.

User ID length

The user IDs you send to Google Analytics must be less than 256 Unicode characters in length or less.

User-ID doesn't apply to historical data

You'll see User-ID data beginning after you’ve implemented the feature. Any data in your Analytics account collected and recorded prior to implementation won't be reprocessed and associated with a user ID.

User-ID data can't be merged across properties

User-ID data collected in one property can't be shared or mixed with data in another property.

Was this helpful?
How can we improve it?
Clear search
Close search
Google apps
Main menu
Search Help Center