Why URL query strings trigger Google PII violations
Sending raw emails or postcodes in your URLs will get your GA4 property flagged for PII violations. We explain how to scrub URLs and hash data safely.
Your analytics property is flagged for a PII violation because a form or email campaign is appending raw, unhashed customer details directly into the page URL. When a user lands on example.com/?email=buyer@company.com, Google Tag Manager reads the full address bar and transmits it straight into GA4 and Google Ads as part of the standard page_location parameter.
When a marketing team builds a custom email flow or a multi-step application form, they often use URL query strings to pass data between pages. It is a fast, simple development trick.
We check the Google Analytics property a month later and find a bright red warning banner. Google's automated systems have detected cleartext Personally Identifiable Information (PII) in the reports. If the issue is not fixed within 30 days, Google usually deletes the historical data for the affected date range, or suspends the property entirely.
The mechanical risk of the address bar
Google's Terms of Service explicitly forbid sending any information that could be used to identify an individual-such as names, raw email addresses, postcodes, or phone numbers-into their standard reporting tools.
The problem is that the full URL is the foundational data point for almost every tracking script on the internet. Every time a page loads, GA4 automatically collects window.location.href.
If a CRM sends a "Complete your profile" email with a link formatted as site.com/profile?user=name&zip=SW1A, that entire string is logged in the "Pages and screens" report. It is now permanently stored in Google's servers in plain text.
| Data Passed in URL | Risk Level | Google Policy Consequence |
|---|---|---|
?source=newsletter | Safe | None (Standard UTM tracking). |
?client_id=987654 | Safe | None (Anonymous database identifier). |
?postcode=SW1A1AA | Violation | Warning and potential data deletion. |
?email=john@test.com | Severe Violation | Immediate warning and data purging. |
This extends beyond GA4. If you are running Google Ads, transmitting raw PII in standard pageview events violates their advertising policies. The ad platforms expect this data to be securely hashed before it ever leaves the browser.
The financial cost of deleted data
When you receive a PII violation, you do not just get a warning. If you fail to scrub the data, Google drops the hammer on your historical reporting.
Consider an eCommerce retailer spending heavily on Black Friday campaigns. Their custom checkout accidentally passes the billing postcode in the URL during the final confirmation step.
| Action | Reporting Status | The Commercial Impact |
|---|---|---|
| November 1-30 | Tracking records £850,000 in sales. | Campaigns optimise perfectly. |
| December 5 | Google detects PII in the URL string. | Warning issued. 30 days to resolve. |
| January 5 | Issue unfixed. Data is purged. | Entire November revenue history is permanently deleted from GA4. |
You cannot selectively delete the postcodes from the GA4 database. Google deletes the entire event or the entire day's data. You lose the attribution, the conversion counts, and the ability to compare Year-on-Year performance for your most profitable month, simply because a developer used a lazy URL parameter.
Scrubbing the URLs and hashing the data
If you are auditing your Google Tag Manager setup for compliance, the fix requires a layered approach to intercepting and redacting the data before it transmits.
First, we check GA4's native redaction settings. Inside the Data Streams admin panel, Google now offers a "Redact data" toggle. We configure this to automatically strip email addresses and specific query parameters (like ?zip= or ?email=) client-side. The browser strips the PII out and replaces it with [redacted] before it ever hits Google's servers.
Second, if the data is required for Google Ads Enhanced Conversions, we implement strict SHA-256 hashing. Google Ads expects user data to improve match rates, but it must be mathematically scrambled. We write a custom JavaScript variable in GTM that reads the URL, extracts the email, trims any accidental spaces, converts it to lowercase, and hashes it using the SHA-256 algorithm. The raw email is then scrubbed from the URL, and only the secure hash is sent to the advertising platform.
Finally, we enforce Consent Mode v2 protections. If a user rejects advertising cookies, we ensure redact_ads_data is set to true. This tells the Google tags to strip out click identifiers like gclid from the network requests, ensuring no pseudo-anonymous tracking can be stitched back together without consent.
The aim is straightforward. You keep your conversion data, and you keep your analytics property out of the penalty box.
Frequently asked questions
Can I just use URL shorteners to hide the PII?
No. When a user clicks a shortened URL, their browser resolves the redirect and lands on the final destination URL. The final URL, complete with the raw PII query strings, is what sits in the address bar. That is what GTM and GA4 will capture and send.
Does hashing an email make it safe for GA4?
No. Google explicitly warns against sending even hashed PII into GA4 custom dimensions if it can be reverse-engineered or used to track an individual across the web. Hashed PII is strictly meant for the user_data object in Google Ads for conversion matching, never for standard analytics reporting.
If we fix the code today, will Google restore our historical data?
No. If Google purges a date range due to a PII violation, that data is permanently destroyed. They do not quarantine it and give it back once you fix the tracking. This is why immediate redaction at the GTM level is critical the moment a warning appears.
Why do CRMs build links with emails in them?
Many CRMs append emails to links so that if the user lands on a form, the website can read the URL and pre-fill the email address field to reduce friction. While this is good for conversion rates, it is terrible for analytics compliance. The developer must scrub the URL using the browser's history.replaceState() immediately after reading it.
Does the GA4 native redaction catch everything?
The native "Redact data" feature is highly effective at catching standard email patterns (like name@domain.com), but it can miss unusually formatted strings or raw phone numbers. It is a safety net, not a replacement for keeping PII out of your URLs in the first place.