On this page
What this issue is
GA4 has a user_id setting. It lets you recognise the same logged-in person across devices. The value should be an ID that means nothing outside your own systems, such as cust_48213.
This issue happens when the value is an email address like jane@example.com. It often comes from a login plugin, a GTM variable that reads the account email, or a developer who used the email because it was the easiest unique field. An email is personally identifiable information (PII): data that points to a real person.
The same problem can also appear in other places, such as an email in a page URL (/thanks?email=jane@example.com), in an event parameter, or in a user property. This guide focuses on user_id, but the check and the cleanup apply to all of them.
Why it costs you leads or sales
It rarely breaks a form on the day. The cost shows up later and is larger when it does.
- Google can ask you to remove the data, or can delete data that breaks its policy, which leaves holes in your reports.
- Customers' emails sit in a third-party tool, which creates privacy and data protection risk (for example under GDPR) and can mean a breach you must handle.
- Emails can flow on to linked tools, such as Google Ads audiences and BigQuery exports, and spread the problem.
- Cleaning up later is slower: you cannot edit old hits, so the bad data stays until it expires or is deleted.
- Fixing it in a hurry can break your user_id tracking, so cross-device reporting drops out until it is rebuilt.
- Visitor logs inAccount email is available in the page or data layer
- Tag reads the emailGTM variable or script sets user_id to the email
- Hit sent to GA4Request carries up=jane@example.com
- Reports and exportsEmail stored in Google's systems and linked tools
The email leaves your site at the tag step. Everything after that holds personal data.
How to check if your site has it
Open a logged-in page
Log in to your site with a test account that uses a fake email you control, for example test+ga4@yourdomain.com.
Open the browser Network tab
In Chrome, press F12, choose Network, and filter by
collect. Reload the page.Inspect the GA4 requests
Click a request to
google-analytics.com/g/collect. In the Payload or Query String Parameters, look foruid. Also search the whole request for@and for your test email.Check GTM Preview modeGoogle Tag Manager
If you use Google Tag Manager, open Preview, select your GA4 tag and look at the Fields to Set and Configuration settings for
user_id. Open the Variables tab and see what value the variable holds.Check GA4 DebugView
In GA4, go to Admin > DebugView, and click an event. Look under User properties and event parameters for an email.
Check URLs too
Look at the
dlparameter (page location) in the request. If a query string contains an email, that is PII in the URL too.
https://www.google-analytics.com/g/collect?v=2&tid=G-XXXXXXX&en=page_view&uid=jane%40example.com&dl=https%3A%2F%2Fexample.com%2FaccountHow to fix it
The fix has two parts: stop sending the email, then send a safe ID instead. Pick the safe ID first, because your developer or platform needs a value to use.
| Option | Safe? | Notes |
|---|---|---|
| Internal customer or database ID | Yes | Best choice. Meaningless outside your systems. |
| Random ID (UUID) stored on the account | Yes | Good if you have no customer number. |
| Email address | No | This is the problem. Remove it. |
| Plain hash of the email (for example SHA-256) | Risky | Can be matched against known emails. Avoid it for user_id. |
Find the variable
In GTM go to Variables and find the one used for user_id. Check your GA4 tag's Fields to Set, or the Google tag's Configuration settings, for the field
user_id.Change its source
Point it at a data layer variable that holds the internal ID (for example
customer_id), not the email.Test in Preview
Run Preview, log in with the test account and confirm the variable shows the new ID. Then publish a new container version.
Find the source
Check your analytics plugin (such as Site Kit or a GA4 plugin) for a user ID or tracking option, and check your theme's header code and any snippet plugin for
user_id.Use the WordPress user ID
Replace the email with
get_current_user_id(), which returns the numeric account ID. See the code below.Clear caches
Purge page and CDN caches so old pages with the email stop being served.
Find the code
Check Online Store > Themes > Edit code (theme.liquid), your Customer events (custom pixels) and any analytics app for
user_idorcustomer.email.Use the customer ID
Replace
customer.emailwithcustomer.id. See the Liquid snippet below.Check apps
If an app sets the value, change its setting or contact the app developer.
Search your codebase
Search for
user_idand forgtag('set'andgtag('config'calls that pass an email value.Pass the internal ID
Have your server render the internal ID into the page, and pass that to GA4 instead of the email.
Stop setting it for logged-out users
Only set user_id after login, and clear it on logout by setting it to null.
Check custom code
Look in Sites > Funnels or Websites > Settings > Tracking Code, and in any custom code block, for a script that sets
user_idfrom a contact merge field such as the email.Remove the merge field
Delete the line or replace it with a non-personal ID. If you have no safe ID, do not set user_id at all.
<?php
add_action('wp_head', function () {
if (is_user_logged_in()) {
$id = get_current_user_id();
echo "<script>window.dataLayer=window.dataLayer||[];dataLayer.push({'customer_id':'" . esc_js($id) . "'});</script>";
}
});{% if customer %}
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({ 'customer_id': '{{ customer.id }}' });
</script>
{% endif %}// BAD: gtag('config', 'G-XXXXXXX', { user_id: 'jane@example.com' });
// GOOD:
gtag('config', 'G-XXXXXXX', { user_id: 'cust_48213' });Remove emails from URLs and parameters
Stop forms from redirecting to URLs that contain an email. Use POST or a session instead of query strings.
Review other fields
Check event parameters and user properties for emails, names or phone numbers too.
Deal with data already collected
Old hits cannot be edited. In GA4, see Admin > Data collection and modification > Data deletion requests to ask for removal of the affected data. Involve your privacy lead or data protection officer, as you may have to document the incident.
Tell connected tools
If GA4 feeds BigQuery or Google Ads, check those places for the email too.
Before
- user_id is jane@example.com
- Email visible in the request and DebugView
- Breaks Google's PII policy
After
- user_id is cust_48213
- No @ sign in any GA4 request
- Cross-device reporting still works
The tag passes account data on to Google when it should pass a safe ID.
How to confirm it's fixed
- Log in with the test account, reload, and filter the Network tab by
collect. No request contains@or the test email. - The
uidvalue is your internal ID. - GTM Preview shows the user_id variable holding the safe ID.
- DebugView shows no email in user properties or event parameters.
- The
dlpage location has no email in the query string. - Log out and check that
uidis gone. - Test on mobile and in a private window, as cached pages can keep sending the old value.
How to prevent it happening again
- Write down which ID is allowed as user_id and share it with developers and agencies.
- Review GTM changes before publishing, especially variables that read account or form data.
- Never put form values in URLs. Use POST or a session.
- Test after every theme, plugin or login-system change.
- Add a PII check to your launch checklist for new sites and funnels.
- Re-check regularly, because a plugin update can bring the problem back.
How FunnelGuard handles this
FunnelGuard detects this issue today. Its robot visitor runs your real journeys on a schedule and runs a no_pii_in_tracking check on the tracking hits it captures along the way. If a hit contains personal data such as an email address, the check fails.
A failure is re-checked from a second region before one alert is sent, with a screenshot and a likely cause. You can get it by email, Slack, Teams, WhatsApp, webhook or PagerDuty.
What this means in practice: the robot can only see what its own test journeys send. It does not search the data already stored in your GA4 property, so you still need to handle old hits yourself. FunnelGuard marks its test traffic (utm_source=funnelguard, fg_test=1, an fg_test cookie and its own user agent) and never enters real card details. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans have a 3-day free trial. A free read-only website audit is also available.
Questions people ask
Can I use an email address as the GA4 user_id?
No. Google's Analytics policies prohibit sending personally identifiable information such as email addresses. Use an internal customer ID or a random ID that cannot be traced back to a person outside your own systems.
Is a hashed email OK as a GA4 user_id?
It is safer than a plain email but still risky. A simple hash such as SHA-256 of an email can be matched against known addresses, so it may still count as personal data. An internal ID or random UUID is the better choice.
How do I check if my GA4 is sending emails?
Open the Network tab in Chrome, filter by collect and look at the GA4 requests on a logged-in page. Search for uid and the @ sign. You can also check DebugView in GA4 and the Preview mode in Google Tag Manager.
What happens if GA4 collects email addresses?
Google can ask you to remove the data or can delete data that breaks its policy. You may also have a privacy issue under laws like GDPR. Fix the source, then request deletion of the affected data.
How do I delete emails that GA4 already collected?
You cannot edit old hits. In GA4 go to Admin > Data collection and modification > Data deletion requests to ask for removal. Speak to your privacy lead about whether you need to record or report the incident.
Why is there an email in my GA4 page URLs?
A form or login probably redirects to a URL with the email in the query string, such as /thanks?email=.... GA4 records the page URL, so it records the email. Change the form to use POST or a session, and stop passing personal data in links.
Will changing user_id break my GA4 reports?
Reports based on the old values will not join up with the new IDs, so cross-device matching restarts. This is a small cost compared with keeping personal data in Google's systems. Use a stable internal ID from now on so it does not change again.
Can FunnelGuard tell me if GA4 is getting an email?
Yes, for the journeys it runs. Its no_pii_in_tracking check looks at the tracking hits captured during the test and fails if one contains personal data like an email. It does not scan data already stored in GA4.
Related issues
- TRK-026GA4 user_id set to a constant value for all usersFix guide
- TRK-020GA4 hits sent with debug_mode on in productionFix guide
- TRK-021Hits marked traffic_type=internal for all visitorsFix guide
- TRK-017Google signals settings misconfiguredFix guide
- TRK-005Two GA4 measurement IDs sending to the same propertyFix guide
- TRK-001GA4 tag missing from a funnel pageFix guide