What the GA4 User ID Feature Does
By default, GA4 identifies users by a browser-level cookie (the _ga cookie / client_id). When the same person uses your site on a laptop, then on a phone, then on a tablet, GA4 counts them as three separate users. The User ID feature solves this — by passing a consistent user identifier (from your authentication system) to GA4, the same user is recognised as one user across all their logged-in sessions.
When User ID Is Worth Implementing
User ID is valuable when:
- Your site has user accounts (login required for some actions)
- A significant portion of your conversions happen on different devices from initial discovery
- You want accurate returning user metrics for logged-in users
- You run a subscription or SaaS product where user-level LTV analysis is important
It is less valuable when your site has very low logged-in usage or single-session purchase journeys.
How to Implement GA4 User ID
Option 1: Via gtag.js directly
When a user logs in, set the user_id parameter on the GA4 tag:
gtag('config', 'G-XXXXXXXXXX', {
user_id: 'USER_ID_FROM_YOUR_AUTH_SYSTEM'
});
The USER_ID must be a non-personally-identifiable identifier from your system — a hashed user ID or an internal numeric identifier. Never pass email addresses or names as user_id.
Option 2: Via GTM
- Push the user ID to the data layer when a user logs in:
dataLayer.push({user_id: '12345'}) - In GTM, create a Data Layer Variable for user_id
- Add the user_id variable to your GA4 Configuration Tag as a "user_id" configuration parameter
Privacy Requirements
Before implementing User ID, you must:
- Update your Privacy Policy to disclose that logged-in users are tracked across devices
- Obtain appropriate consent (in the EU/UK, this typically requires explicit consent for personalised analytics)
- Use only pseudonymised identifiers (internal user IDs, not emails or names)
- Ensure your Terms of Service discloses analytics data use
Do not pass the same user ID for anonymous/logged-out sessions — this would incorrectly associate anonymous browsing with a specific user's identity.
What User ID Enables in GA4 Reports
- More accurate user counts: GA4 recognises a logged-in user on desktop and mobile as one user, reducing artificial user count inflation
- Cross-device attribution: conversions completed on mobile are correctly attributed to the acquisition channel even if discovery happened on desktop
- User Lifetime reporting: GA4's User Lifetime report shows LTV and engagement over a user's entire GA4 history — requires User ID for accuracy
- Cohort analysis by first login date: track how user cohorts acquired in different months retain and convert over time
Combining User ID with Google Signals
GA4 has three identity spaces: User ID (your system), Google Signals (logged-in Google users), and Device ID (cookie). You can use all three simultaneously — GA4 combines them using a priority order (User ID highest priority, then Google Signals, then Device ID) to create the most accurate user count possible.
Summary
GA4 User ID implementation enables cross-device user recognition for logged-in users. It requires passing a pseudonymised user identifier from your auth system to GA4 via gtag or GTM, a privacy policy update and consent framework, and care to only pass User ID for authenticated sessions. For SaaS, subscription, and account-based businesses, it dramatically improves user-level data quality.
See our GA4 Setup & Audit service for User ID implementation.
Need cross-device user tracking set up? Contact Adslytics.
Need expert tracking setup?
Our Google Tag Manager experts have delivered 500+ tracking setups with a 98% success rate.
Get a Free Consultation →