On this page
What this issue is
user_id is a GA4 field you set yourself. It lets GA4 recognise the same person across devices and sessions once they sign in. GA4 trusts whatever you send. It does not check that the value is unique.
This issue happens when every visitor gets the same value. Common causes: a hardcoded test ID left in the code, a Google Tag Manager variable that returns undefined, null or 0 as text, a template tag that was never filled in (such as {{user.id}} printed literally), or a CRM or form variable that falls back to a default.
Why it costs you leads or sales
With one ID shared by everyone, GA4 sees one very busy person. User counts shrink, and journeys from different people are stitched into one path. Funnel and path reports stop reflecting real behaviour, and the conversion rate per user looks wrong.
That feeds bad decisions. You may cut a campaign that works, because its users look like repeat visitors who already converted. Audiences built on this data (for remarketing, for example) can also be wrong. The impact is medium: leads are not lost directly, but the numbers you steer by are.
Example: 5,000 signed-in visitors in a month. With a constant user_id, user-based reports can show a tiny fraction of that.
- Visitor A logs inuser_id = "undefined"
- Visitor B logs inuser_id = "undefined"
- GA4 merges themOne user, many devices
- ReportsUsers, funnels and paths are wrong
Every visitor is sent the same ID, so GA4 cannot tell them apart.
How to check if your site has it
Open GA4 DebugView
In GA4 go to Admin > DebugView. Turn on debug with Google Tag Assistant or the GA debugger extension, then browse your site while signed in. Click an event and look at its user properties and the user_id.
Test with two accounts
Sign in as two different test users in two browsers. If both show the same user_id, you have the problem.
Inspect the network request
Open browser DevTools > Network, filter for
collect, and click a GA4 request to google-analytics.com. Look for theuidparameter in the request. Check it differs per user and is notundefined,null,0or a placeholder.Check the reports
In Reports > Explore, create a free-form report with User ID as a dimension. One value covering nearly all traffic is a red flag.
How to fix it
The fix has two parts: find where the value comes from, then make sure it is a real per-user ID that is only set after login. Use an internal ID such as a database user number, never an email address or name.
Find the source variable
Open your GA4 Configuration tag (or Google tag) and look under Fields to Set or User Properties for
user_id. Note which variable it uses.Fix the variable
If it is a Constant variable, replace it with a Data Layer Variable (for example
user.id) pushed by your site after login. If it is a JavaScript variable, make sure it returns the real ID.Skip empty values
Add a trigger or condition so user_id is only set when the variable is not undefined and not empty. Use Preview mode to confirm.
Set the ID only after login
Call gtag config or set with the real ID once you know it. Do not set a default for anonymous visitors.
Clear it on logout
Set user_id to null when a user signs out so the next person on a shared device is not linked to the last one.
Check the plugin settings
If a plugin (such as a GA4 or WooCommerce analytics plugin) has a User ID option, confirm it uses the logged-in user's numeric ID, not a fixed text field.
Search the theme
Search your theme and custom code snippets for
user_idto find a hardcoded value.
Use the customer ID
In theme code or a custom pixel, use the Liquid
customer.idvalue, only when a customer is logged in. Check the value is not empty.Remove leftover test code
Search theme.liquid and any custom pixel for a hardcoded user_id.
Check custom code
In Project Settings > Custom Code and page-level code, look for a user_id line. Webflow has no built-in login ID, so your membership or app tool must supply it.
Review custom code
In Settings > Custom Code, look for any script setting user_id. If you use Velo, check the member ID is read per logged-in member.
Check code injection
In Settings > Advanced > Code Injection, look for a hardcoded user_id. Remove it unless you have a real per-member ID source.
Check tracking code
In Settings > Custom Code, funnel and website tracking code, look for a fixed user_id. Only send a contact or user ID if it is filled per person.
// Run after you know who the user is
function setGaUser(userId) {
if (userId && String(userId) !== 'undefined' && String(userId) !== 'null') {
gtag('config', 'G-XXXXXXXXXX', { user_id: String(userId) });
}
}
// On logout
function clearGaUser() {
gtag('set', { user_id: null });
}window.dataLayer = window.dataLayer || [];
dataLayer.push({
event: 'login',
user: { id: '48213' } // your internal user number, not an email
});Broken
- Every visitor sends uid=undefined
- GA4 shows one user for all signed-in traffic
- Anonymous visitors also carry an ID
Fixed
- Each signed-in user sends their own internal ID
- Anonymous visitors send no uid
- User counts match real people
Constant ID
Leads or data lost
GA4 merges all signed-in visitors into one user. User counts collapse and paths are mixed together.
Toggle the cause to see how user reports change.
How to confirm it's fixed
- Two different test accounts show two different user_id values in DebugView
- The
uidparameter in the collect request is a real ID, neverundefined,nullor a placeholder - Logged-out visitors send no uid
- After logout, user_id is cleared
- New data in Explore shows many User ID values, not one
- Wait a day or two: old data stays wrong, only new data is clean
How to prevent it happening again
- Never hardcode a user_id, even for testing. Use a debug-only branch.
- Use GTM Preview and DebugView with two accounts before publishing any analytics change
- Only set user_id when a real value exists
- Use an internal ID, not an email, name or phone number
- Review user_id after theme, login plugin or membership tool updates
- Keep a short change log of analytics edits
How FunnelGuard handles this
FunnelGuard does not check for this yet. Comparing user_id values across visitors is a possible future check, but today it is not part of the product.
What FunnelGuard does cover nearby: a robot visitor runs your real journeys on a schedule and checks that the GA4 tracking hits are sent at each step, so a missing or broken GA4 tag shows up. It does not inspect whether your user_id is unique, because the robot does not sign in as real users.
To watch for this manually, re-run the two-account DebugView test after each release, and add a monthly look at a User ID report in Explore. If one ID accounts for most traffic, investigate. You can start with the free plan (1 site, 2 journeys, daily checks) to keep the rest of your tracking monitored.
Questions people ask
Why does GA4 show only one user for all my traffic?
The most likely cause is a user_id that is the same for every visitor, such as a hardcoded value or the text "undefined". GA4 treats the same user_id as the same person. Check the uid parameter in the collect request and fix the variable that supplies it.
What should I use as a GA4 user_id?
Use a stable internal ID, such as a database user number, that is unique per person and carries no personal data. Do not use an email address, name or phone number. Send it only after the person has signed in.
How do I check what user_id GA4 is receiving?
Open Admin > DebugView in GA4 while browsing your site in debug mode and click an event to see the user_id. You can also open DevTools > Network, filter for collect, and read the uid parameter. Test with two different accounts.
Should I send a user_id for logged-out visitors?
No. Anonymous visitors should send no user_id at all. A default value for logged-out users makes them all look like one person.
Why is my GA4 user_id showing undefined or null?
The variable feeding user_id is returning no value when the tag fires, often because the data layer push happens after the tag, or the user is not signed in. Fix the timing or only set the ID when a real value exists.
Will fixing the user_id repair my old GA4 data?
No. GA4 does not rewrite past data, so earlier reports stay merged. Only data collected after the fix is accurate, so note the fix date.
Does FunnelGuard detect a constant GA4 user_id?
Not yet. It is a possible future check. FunnelGuard does check that GA4 tracking hits are sent during your journeys, but for user_id you need a manual test with DebugView.
Related issues
- TRK-025GA4 user_id set to an email addressFix guide
- TRK-005Two GA4 measurement IDs sending to the same propertyFix guide
- TRK-006GA4 installed twice (gtag.js and GTM) causing double page_viewsFix guide
- TRK-021Hits marked traffic_type=internal for all visitorsFix guide
- TRK-022Test traffic not marked internal (pollutes reports)Fix guide
- TRK-020GA4 hits sent with debug_mode on in productionFix guide