Send user IDs

  • User IDs, assigned by you, enable tracking user behavior across sessions, devices, and platforms in Google Analytics.

  • To send user IDs to Google Analytics, ensure you have a Google Analytics account, a web data stream, and the Editor role or higher.

  • Avoid setting custom dimensions based on user IDs and sending user IDs when a user isn't signed in to maintain data accuracy.

  • Before implementing user IDs, review the best practices and guides linked in the document to avoid potential issues.

User IDs are your own unique identifiers that you assign to individual users. This guide explains how to send user IDs to Google Analytics, so you can connect user behavior across different sessions, devices, and platforms.

To learn more about the User-ID feature, see Measure activity across platforms. To learn how to set a user ID for an app, see Set a user ID.

Setting custom dimensions based on user IDs leads to dimensions with too many unique values. Having too many unique values causes issues with Google Analytics data and reporting accuracy. Learn more about best practices for setting custom dimensions.


Before you begin

Before you can send user IDs, make sure you've completed the following:

Send user IDs

The value you send for user_id depends on the state of the user:

  • User has never signed in: Don't send the user_id parameter.
  • User is signed-in: Send their user ID.
  • User was signed-in, then signed out: Send null.