GA4 User-ID Tracking: How to Follow Users Across Devices

Emily RedmondData Analyst, EmilyticsApril 18, 2026

GA4 User-ID Tracking: How to Follow Users Across Devices

By Emily Redmond, Data Analyst at Emilytics · April 2026

TL;DR: User-ID tracking links the same person across devices, browsers, and sessions. Send your internal user ID to GA4 (login ID, email hash, etc.), and GA4 stitches their behavior together into one user profile.


By default, GA4 treats a user on an iPhone and the same person on a desktop as two different users. User-ID tracking fixes this. It's essential for understanding true user journeys.


What Is User-ID Tracking?

User-ID is a unique identifier you assign to each user in your system. Examples:

  • Database user ID (e.g., "user_12345")
  • Email address (or hash, for privacy)
  • Account username
  • Customer ID from your CRM

When you send this ID to GA4, GA4 says: "This is user_12345. Track all their actions across devices and browsers."

Result: One user profile per person, not one per browser.


Why User-ID Tracking Matters

Without User-ID

DeviceGA4 SeesReality
iPhoneUser APerson A
DesktopUser BPerson A
TabletUser CPerson A

GA4 sees 3 users. Reality: 1 person.

Consequences:

  • User metrics are inflated (you have 3x more "users" than actual people)
  • Conversion metrics are wrong (one person's 3 devices get counted as 3 conversions)
  • Audience targeting is based on incorrect data
  • You can't see true user journeys (person starts on mobile, completes on desktop)

With User-ID Tracking

DeviceGA4 SeesReality
iPhoneUser APerson A
DesktopUser APerson A
TabletUser APerson A

GA4 sees 1 user. Reality: 1 person.

Now:

  • User counts are accurate
  • You can see full journeys (person browsed on mobile, purchased on desktop)
  • Cross-device attribution works (retargeting ad on mobile → purchase on desktop gets proper credit)
  • Audience building is based on true user behavior

Prerequisites

  1. Users must be logged in: You only track logged-in users (you have their ID)
  2. Legal basis: You have consent to track identified users. Check GDPR, CCPA, etc.
  3. Privacy: Hash sensitive IDs (don't send raw emails)

How to Set Up User-ID Tracking

Step 1: Generate a User-ID

In your application, create a unique identifier for each user. It should be:

  • Permanent: Doesn't change (use database ID, not IP address)
  • Unique: One ID per user
  • Stable: Same ID across all sessions/devices
  • Non-PII (ideally): Don't send raw email/name; use hashed or system ID

Example in JavaScript:

// After user logs in, get their ID
const userId = user.id; // e.g., "user_12345" or hash of their email

Step 2: Send User-ID to GA4

Via Google Tag Manager (Recommended)

  1. Set a data layer variable for user ID
  2. Create a GA4 config tag
  3. Set the User-ID field

In your page code:

dataLayer = [{
  'user_id': 'user_12345'  // or hashed email
}];

In GTM, create a GA4 config tag:

  • Set User ID field to {{user_id}} (or your data layer variable)
  • Fire on "Initialization - All Pages" (after user logs in)

Via Code (Direct gtag)

// After user logs in
gtag('set', {
  'user_id': 'user_12345',
  'user_properties': {
    'email': user.email,  // optional, user property
    'tier': 'premium'     // optional, user property
  }
});

Then, on every page the user visits:

gtag('config', 'G-MEASUREMENT_ID', {
  'user_id': 'user_12345'
});

Step 3: Enable User-ID in GA4 Settings

  1. Go to GA4 → Admin
  2. Under "Data collection and modification," click Data settings
  3. Find "User-ID" and toggle it ON

GA4 now accepts and uses User-IDs.

Step 4: Create a User-ID View (Optional)

User-ID data is combined with anonymous data by default. To see only identified users:

  1. Go to AdminData streams
  2. Look for "User-ID view" option
  3. Create a User-ID-only view

This view shows only logged-in users, with unified cross-device tracking.


Verifying User-ID Tracking

In Real-Time

  1. Log in to your site
  2. Go to GA4 → Real-time
  3. Perform an action
  4. In the real-time report, you should see your user ID in the User ID field

If you see your user ID, tracking is working.

In Standard Reports

  1. Go to any report
  2. Add a filter: "User-ID" = (your user ID)
  3. You should see your behavior across devices

In Explorations

Create an exploration:

  • Dimension: User ID
  • Metrics: Session count, event count, conversions
  • Filter: User-ID = (a specific user)

You now see all events for that user across all devices.


Using User-ID for Analysis

Cross-Device Journeys

"Show me users who browsed on mobile but purchased on desktop."

  1. Create exploration
  2. Dimension: Device category
  3. Metrics: Conversions
  4. Segment: Users with >1 device session

This shows how many users used multiple devices.

User Retention

"Of users who signed up 30 days ago, how many are still active?"

  1. Dimension: Days since first session
  2. Metrics: Active users, sessions
  3. See engagement over time

High-Value User Analysis

"Which users are most valuable?"

  1. Dimension: User ID
  2. Metrics: Total revenue, session count, days active
  3. Sort by revenue

Find your power users.


Privacy and Legal Considerations

GDPR Compliance

  • User-ID is PII (personally identifiable information)
  • You need explicit consent to track identified users
  • Provide a privacy policy
  • Let users opt-out

Hashing

Don't send raw emails or names. Hash them:

// Bad (don't do this)
gtag('set', {'user_id': '[email protected]'});

// Good (hash the email)
const hashed = SHA256('[email protected]');
gtag('set', {'user_id': hashed});

Data Retention

Identified user data is subject to data retention settings. Make sure you're compliant with your local laws.


Common Mistakes

Mistake 1: Sending PII Directly

Bad: User-ID = "[email protected]"

Good: User-ID = SHA256("[email protected]")

GA4 recommends hashing sensitive data.

Mistake 2: Changing User-IDs

If a user's ID changes (password reset, new account), GA4 sees them as a new user.

Use stable IDs that don't change.

Mistake 3: Only Setting User-ID on First Visit

User-ID must be set on every visit, or GA4 won't connect them.

Set it on every page after login:

gtag('config', 'G-MEASUREMENT_ID', {
  'user_id': 'user_12345'
});

Mistake 4: Forgetting to Enable in Settings

User-ID won't work unless you toggle it ON in Admin settings.


Data Limitations

  • Only applies to logged-in users: Anonymous users are still tracked separately
  • Retroactive application: Only applies to new data. Old data before User-ID setup won't be unified
  • Consent required: You need users' consent to track them identified

Frequently Asked Questions

Q: Does User-ID tracking work with Google Ads? A: Yes. GA4 User-IDs can sync to Google Ads, enabling cross-device audience targeting.

Q: What if some users never log in? A: They're tracked anonymously (via client-side cookies). User-ID is for logged-in users only.

Q: Can I use User-ID retroactively for old data? A: No. User-ID only works for new data after you set it up.

Q: Is User-ID hashing required? A: No, but recommended for privacy. GA4 accepts any user ID.

Q: How long can a User-ID be? A: GA4 recommends <256 characters. Keep it short.


The Bottom Line

User-ID tracking is essential for any business with logged-in users. It gives you accurate user counts, true cross-device journeys, and power to identify your best users.

Set it up early (it's easier to start fresh than retrofit). Implement it correctly (hash sensitive data, set it on every page). Then use it to understand your real user behavior.


Emily Redmond is a data analyst at Emilytics — the AI analytics agent that watches your GA4, Search Console, and Bing data around the clock so you never miss what matters. 8 years of experience helping founders and growth teams turn data noise into clear decisions. Say hi →