Search
Clear search
Close search
Google apps
Main menu

Set up User-ID

First enable User-ID in your account, then implement it in your code.

To set up the User-ID feature, you must first enable it in your Analytics account and then implement it in your tracking code.

You also have to create a User-ID view to see the data in your Analytics reports.

Learn more about User-ID and read about User-ID limits before you implement this feature.

In this article:

Set up User-ID in your account

You must have Edit permission for the property.

To set up User-ID:

  1. Sign in to Google Analytics.
  2. Click Admin, and navigate to the property in which you want to implement User-ID.
  3. In the PROPERTY column, click Tracking Info > User-ID.
  4. Follow the steps outlined in the following sections.

1. Agree to the User-ID Policy

  1. Read the User-ID Policy.
  2. Under I agree to the User-ID Policy, set the switch to ON. Agreeing to the policy enables the feature in your account.
  3. Click Next Step.

2. Set up User-ID in your tracking code

After you enable User-ID by agreeing to the policy, you must implement User-ID in your tracking code.

To employ User-ID, you must be able to generate your own unique IDs, assign IDs to new users and consistently reassign the same IDs to returning users, and include these IDs in the data you send to Analytics.

In this step, you can see the line of code that you have to add to your Analytics tracking code:

ga('set', 'userId', {{USER_ID}}); // Set the user ID using signed-in user_id.

The tracking-code update should be completed by a developer. See Related resources below for more information.

You can employ User-ID for both websites and mobile apps. Both types of reporting views (web and app) will accept both web and app hits and report them together. With User-ID, we recommend that you maintain a consolidated view that includes all types of hits, and that you configure filtered views to isolate web and app hits as necessary.

Session unification

Session unification lets you associate hits that are collected before the User ID is assigned with the User ID when it is assigned, so long as those hits occur in the same session in which the ID is assigned for the first time.

Session unification is on by default.

When session unification is off, only hits that are collected when the User ID is already assigned are associated with an ID.

Learn more about session unification

  1. Turn session unification ON or OFF as necessary.
  2. Click Next Step.
Using Google Tag Manager? See how you can use Google Tag Manager to implement User-ID in your Analytics tracking code.

3. Create a User-ID reporting view

User-ID data can appear only in a dedicated User-ID view.

  1. Click Create.
  2. Enter a Reporting View Name.
    You might want to include the term "User ID" in the name to help you remember that this is a special User-ID view.
  3. Select a Reporting Time Zone.
  4. Click Create.

You can create more User-ID views anytime by following the standard process to create a new view.

User-ID Views can't be converted to standard views, and standard views cannot be converted to User ID views. Only new views added to a User-ID enabled property can be designated as User-ID Views.

All reports in a User-ID view display data from sessions in which a User ID is assigned and related data is sent to Analytics. Use a different view to see data from sessions in which a User ID is not sent to Analytics.

Related resources

google-developers-svg

For details on how to add User-ID to your tracking code, refer to the instructions in the Developer Guide for your specific environment:

gtm-logo-sm-svg

Tracking User ID

Was this article helpful?
How can we improve it?
Google Analytics training and support resources

Check out our comprehensive list to learn more about Analytics solutions.