Skip to content
DATANOSTRO ACADEMY

What is client_id and user_id in GA4

client_id and user_id are two identifiers GA4 uses to know whom events belong to. How they differ, why they're crucial for server-side and when to use which.

6 min Read Intermediate Updated 7.6.2026

For GA4 to know that several events belong to one person, it needs an identifier. It uses two: client_id and user_id. They differ in what they identify — and for server-side measurement, setting both correctly is critical.

client_id

client_id identifies a browser or device. GA4 typically stores it in a first-party cookie and uses it to stitch events into one user and session. It's not a specific person — the same person on mobile and desktop has two different client_ids.

user_id

user_id identifies a signed-in person across devices — typically your internal user ID after login. When you send it, GA4 can connect the same person's activity from mobile and desktop into one story.

Why they're crucial for server-side

In server-side measurement, the event isn't sent by the browser but by the server via the Measurement Protocol. If you don't attach the correct client_id, GA4 can't connect the server-side event to the user's browser activity — and sessions fragment, data doesn't add up. Passing the right client_id (and user_id where possible) is therefore one of the most important steps for server-side.

When to use which

  • client_id is always needed — it's the basis for stitching events.
  • user_id add it when you have signed-in users and want to measure across devices. For cross-device identification, see the User ID docs.

For broader context on identification and longer lifetimes, see conversion attribution and server-side.

Did this article help you?
✓ Thank you for the feedback