The identifiers GA4 counts users with
The GA4 hub sets out the raw material. On the web the default is a client identifier stored in a first-party cookie; apps use an app-instance identifier; a site that signs people in can send a User-ID; and Google signals can add signed-in Google users who have opted in to ads personalisation. Each describes something different, and the difference decides what a user count means.
| Identifier | Who sets it | What it represents | Where it falls short |
|---|---|---|---|
| Client identifier | The tag, in a first-party cookie | One browser on one device | Cleared cookies, a second browser or a second device each look like a new user |
| App-instance identifier | The app's analytics library | One installation of an app | Each installation on each device is counted separately |
| User-ID | Your site or app, from its own records | One signed-in person, as your systems know them | Only covers visits where the person is signed in |
| Google signals | Google, for consenting signed-in Google users | A Google account | Applies only where enabled and only to those users |
The reports and dimensions guide explains how these come together: which people count as one user depends on the property's reporting identity setting, a view-time choice between blending signed-in identifiers, Google signals, device identifiers and modelled data, or relying on device identifiers alone. Switching it changes user counts without changing the stored data. The same guide and the common mistakes guide add the consequence that matters most in practice: under an identity that includes Google signals or modelled data, GA4 withholds small rows to protect individuals, and a device-based identity is one documented way round that. The User-ID is therefore one input among several. It improves the user count only for the people it covers, and the setting decides whether reports use it at all.
When a User-ID is worth sending
The case for a User-ID rests on how much of the business happens signed in and on which questions the business asks. The sessions versus users comparison puts the core issue plainly: one person on two devices is two users unless signed-in or modelled data links them.
| Situation | Worth it? | Why |
|---|---|---|
| Accounts are central: subscriptions, courses, software, banking, a B2B portal | Yes | Most valuable activity happens signed in, often on several devices |
| A shop where repeat customers log in to reorder | Usually | Repeat behaviour and the CRM join both depend on it |
| A shop where almost everyone checks out as a guest | Rarely for counting; possibly for the join | Few events would carry it, but the purchase can still be linked to a customer record |
| A lead-generation site with no sign-in | No | There is no signed-in state to report |
| No consent basis for user-level measurement in a market | Not there | The identifier would sit outside what visitors agreed to |
| The business has no stable internal identifier yet | Not yet | Fix the identifier in the CRM first; analytics should follow it, not invent it |
The questions decide the rest. Retention, repeat purchase, sessionsA group of one user's interactions with a site or app in one visit, ended by inactivity. per person over months, journeys that start on a phone and finish on a laptop, and anything that has to be joined to what the CRM knows about a customer all need a person-level key. Questions about pages, campaigns and visit quality do not, and a User-ID adds nothing to them. Write the decision, with its reasons, into the measurement plan so the next analyst knows why it exists. The academy checkpoint on data layer contracts, embedded tools and User-ID tests when a User-ID is worth sending, what value to use and what it changes in user counts and the export.
Choosing the value
The value is the most consequential decision and the hardest to change later, because every report and join built on it inherits the choice. A good User-ID has five properties.
- Internal. It comes from your own systems: a customer number, an account number, a learner number. Only your systems can resolve it to a person.
- Stable. It never changes for the same person and is never reused for another. A session token, a login name that people can edit or a number reassigned after account closure all fail this.
- The same everywhere. Web, app and any server-side sends use the identical value, so the property and the export can recognise one person across all of them.
- Not a description of a person. No email address, phone number, name or login name that is itself an email address, and nothing that encodes one. The guide to keeping personal data out of analytics explains why a hashed email address is treated as the email it came from.
- Matching the CRM's key. The join described below is only as good as the match between the analytics value and the customer record. Use the key the CRM or CDPUnified first-party customer profiles. already treats as the person identifier, rather than creating a new one for analytics.
One judgement call deserves a sentence. If the customer number is printed on invoices, letters or cards, it is widely known; some businesses therefore keep a separate internal key for analytics, stored against the customer record, so that the value sent to analytics is meaningful to nobody outside the business. Either choice is defensible; decide it deliberately and document it.
For business-to-business products, decide whether the identifier describes a person or an account. A User-ID describes a person; the company they belong to is better sent as a user property, which the events and parameters guide describes as the scope for attributes of the person rather than the action.
Setting and clearing it
The GA4 through GTM tutorial shows the field: user_id is a configuration
parameter on the Google tag, set from a data layer variable when the site identifies a signed-in visitor, and
not a user property. Getting its value into the data layer at the right moments is the site's part of the
contract, and it follows the timing rules of the data layer guide.
On every page while signed in. The page's context push, made before the container snippet, carries the identifier whenever the visitor is signed in, so the Google tag has it from the first event on the page. Sending it only on the sign-in event leaves every later page without it.
At sign-in. When the server confirms the sign-in, not when the button is pressed, push the identifier,
together with the recommended login or sign_up event the events guide lists. Most sign-ins load a new page,
whose context push then supplies the identifier; where they do not, as in a single-page application, confirm in
preview that the events which follow the sign-in carry it.
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "login",
method: "password",
user_id: "L-0048213"
});
At sign-out. Stop sending it. On the next full page load the context push simply omits the key or sends an
empty value, following whichever form the current help page specifies. Single-page applications need care:
the data layer guide explains that the default variable mode merges pushes, so a key omitted from a later push
keeps its old value. A sign-out in a single-page application must therefore reset user_id explicitly in the
data layer, or the next person on a shared device inherits the previous person's identifier.
Test each transition with Tag Manager preview and the browser's network panel, as the
debugging tutorial shows: requests after sign-in carry the
identifier, requests after sign-out do not, and the value matches the account used. The next day, check that
the export's user_id column is filled on signed-in events and empty elsewhere.
What changes in reports and the export
In the interface, the effect depends on the reporting identity. Under an identity that uses signed-in identifiers, a person who signs in on two devices can be counted as one user rather than two, so user counts can fall and per-user rates can rise compared with a device-based view of the same period. Switching the setting changes the view, not the data, so the same property can show both. Explain the setting next to any user-based KPIA metric tied directly to an objective., because a figure that moves when somebody changes an admin option is a figure people will misread.
How earlier signed-out activity is associated with a User-ID, and whether any report or feature depends on the User-ID being present, are documented on Google's current Analytics help pages; read them there rather than from memory, because they have changed over time and this guide does not restate them.
The BigQuery export is simpler, because it applies no identity setting at all. The
BigQuery export basics guide describes two flat columns on every
event row: user_pseudo_id, the device-level identifier, and user_id, the site's own identifier where the
site sets one. Counting distinct user_id values gives signed-in people exactly; counting user_pseudo_id
gives browsers. Any blending, such as treating every device identifier ever seen with a User-ID as that
person, is your own logic, built in your own query and documented as such. The export also keeps those
rows for as long as you keep the tables, which is a privacy decision as much as a storage one.
Consent and privacy
A User-ID is personal data. The GDPR defines personal data broadly and treats pseudonymised data, which can be linked to a person with additional information, as personal data still, and an internal customer number is exactly that: meaningless to outsiders, resolvable by you. It is collected under the same consent and lawful basis as the rest of measurement, recorded in the measurement plan, and named in the privacy notice. The privacy and consent guide covers how those decisions are reached; this guide does not give legal advice.
Consent modeA Google tag feature that adjusts what tags collect according to the visitor's consent choices. gives the practical rule. Google's consent documentation and the
consent mode guide describe analytics_storage as governing storage related to
analytics, such as the identifier that links a visitor's sessions. A person who declined analytics has said no
to being recognised across visits. Set the User-ID only when the visitor's analytics consent is granted, by
having the site or the container check the consent state before the value is placed in the tag's
configuration, and test both branches in preview.
Beyond consent, three habits keep the identifier safe. Keep the mapping from identifier to person in the CRM,
never in analytics. Restrict access to any export table that holds user_id alongside behaviour, because
that table is now a record of what named customers did. And set a retention policy for those tables
deliberately rather than letting them grow by default.
Using it to join analytics to the CRM
The strongest reason to send a User-ID is the join. Analytics knows how people arrived and what they did on the site; the CRM knows who became a customer, what they paid, whether they renewed or finished a course. With the same key on both sides, the export can be joined to CRM outcomes, and channels can be judged on the customers they bring rather than on the sign-ups.
The data flow and integrations guide describes the principle:
resolve identity once, deterministically, on the business's own key, and give every tool the same result. For
analytics that means the CRM's identifier in user_id, and a join in the warehouse:
WITH first_signed_in AS (
SELECT user_id,
ARRAY_AGG(traffic_source.source ORDER BY event_timestamp LIMIT 1)[OFFSET(0)] AS first_user_source,
ARRAY_AGG(traffic_source.medium ORDER BY event_timestamp LIMIT 1)[OFFSET(0)] AS first_user_medium
FROM `project.analytics_property.events_*`
WHERE _TABLE_SUFFIX BETWEEN @start_date AND @end_date
AND user_id IS NOT NULL
GROUP BY user_id
)
SELECT f.first_user_source, f.first_user_medium,
COUNT(*) AS learners,
COUNTIF(c.completed_course) AS completers
FROM first_signed_in f
JOIN `project.crm.learners` c ON c.learner_id = f.user_id
GROUP BY f.first_user_source, f.first_user_medium
ORDER BY learners DESC;
The export's traffic_source record is the user's first-touch acquisition, as the export guide notes, which
suits a question about which channels bring good customers. Check the match before reading the result: the
share of CRM records found in the export, and the share of signed-in users found in the CRM. A low match
usually means the two systems use different keys, or that a cross-domainConfiguring analytics so a visit that moves between a business's own domains stays one session.
hop to a separate account area loses the tag. Keep the joined table's columns to what the question needs, and
remember that a first-partyData a business collects directly from its own customers, visitors and users. join is only as lawful as the consent behind
both halves of it.
Corvelling Learning sends its learner number
Corvelling Learning, an invented online course provider, sends its internal learner number, a value such as
L-0048213 that appears on no certificate or invoice, as the User-ID from the moment a learner signs in. For
the first full month after launch, the property shows 64,200 users under a device-based reporting identity
and 58,900 under the blended identity: about 5,300 fewer, mostly learners who study on a phone during the week
and a laptop at weekends. Active learners per course, a per-user figure, rises accordingly, and the team adds
a note to the dashboard naming the reporting identity each chart uses.
The first CRM join covers learners who enrolled over the previous quarter. Of 4,100 enrolments in the CRM, 3,480 (85%) are found in the export with a matching User-ID; the rest enrolled by phone or signed in only on a domain without the tag.
| First-touch source / medium | Learners matched | Completed a course | Completion share |
|---|---|---|---|
| google / organic | 1,240 | 410 | 33% |
| newsletter / email | 620 | 290 | 47% |
| social / paid | 980 | 150 | 15% |
| (direct) / (none) | 640 | 260 | 41% |
Paid social had looked strongest on enrolments per pound; it is weakest on completion. The team keeps the campaign but changes its optimisation event to the second lesson completed, and shares the query with the CRM team so the same definition is used in both places.
Common mistakes
- An email address, or a hash of one, as the identifier. It identifies the person to anyone holding the address and breaks the analytics terms.
- Setting it on the login event only. Every later page goes out without it; the context push on each signed-in page is what keeps it present.
- Never clearing it. On a shared device the next person's activity is credited to the previous one, especially in single-page applications where the data layer keeps the old value.
- Different values on web and app. The same person becomes two users, and the CRM join matches one of them.
- Ignoring consent. Setting the identifier for a visitor who declined analytics recognises the person they asked not to be.
- Comparing user counts across a reporting identity change. The stored data did not change; the view did.
- Promising features from memory. What GA4 does with earlier signed-out activity and which features need a User-ID belong to the current help pages, not to last year's blog post.
- A wide joined table with open access. Behaviour linked to customer records deserves the CRM's access rules, not the analytics team's.
The GA4 hub places this guide among the other GA4 guides, and the BigQuery export basics guide covers the export schema the joins here rely on.
