A User ID is your own identifier for a signed-in customer, sent to analytics tools such as GA4 so that the same person is recognised across devices and visits. Instead of a laptop and a phone counting as two users, GA4 can join their activity under one ID when the customer logs in on both.
How User ID works
When a customer logs in, your website or app passes a reference for their account, usually an internal database number, to the analytics tag as the user_id field. GA4 stores it alongside the client ID held in the browser’s cookie. Where the same user_id appears on several devices, GA4’s reporting identity can treat them as one user; the default blended identity gives the User ID priority over device identifiers.
The ID only applies while GA4 is told it, so you send it with every page view and event once the customer is signed in, and stop sending it when they log out. Visits on a new device before the customer logs in are still counted against that device.
Other platforms have their own versions. Meta accepts an external ID with Conversions API events, and CRMs and customer data platforms use their own keys. The principle is the same: a stable reference that your business controls.
Why it matters
For businesses where customers log in, such as online shops with accounts, subscription services, member portals and software products, a User ID gives a truer picture of loyalty and journeys. Someone who browses on a phone on the train and buys on a desktop at home becomes one journey instead of two strangers. Retention, cohort and lifetime value analysis all become more accurate.
Under UK GDPR, a User ID is personal data. It is pseudonymous, which lowers the risk, but because your business can link it back to a named account, the rules still apply: you need a lawful basis, your privacy notice must cover it, and the GA4 tag that sends it sets analytics cookies, which need consent under PECR.
Google’s Analytics terms also forbid sending information Google could use to identify a person, so the ID itself must never be an email address, a name or a phone number.
Common mistakes
- Using the customer’s email address as the ID, which breaks Google’s policy and puts readable personal data in your analytics.
- Sending a hashed email instead and assuming that solves it. A hash can still be matched to the address, so use an internal number.
- Sending the same placeholder, such as “guest” or “0”, for logged-out visitors, which merges thousands of people into one user.
- Carrying on sending the ID after logout, so everyone using a shared family computer is attributed to one account.
- Expecting User ID to join up visitors who never log in. It cannot.
How to act on it
Only set it up if a meaningful share of your customers sign in. If they do, ask your developer to push the account’s internal reference into the data layer on login, map it to user_id in your GA4 tag and send nothing for logged-out visitors. Check it in DebugView, then confirm a few days later that user counts in your reports look plausible.
Record the ID in your records of processing and your privacy notice, and make sure your deletion process can remove a person’s analytics data by their ID when they ask; GA4 supports deleting data for an individual user. Planning measurement around what your business actually needs is part of the digital marketing strategy work I do.
