Skip to main content

Samarth Analytics

The PII Audit: Finding Personal Data Leaking into GA4 Through URLs, Titles and Parameters

By Samarth Analytics · Published · Analytics Audits · 7 min read

Summary: Almost nobody sends personal data to GA4 on purpose. It arrives through URLs with an email in the query string, page titles with a customer's name, search boxes people type phone numbers into, and form tags that pass field values. This guide covers the five places personal data leaks in, how to search for it in the GA4 interface and the BigQuery export, how to fix it at the source, and how to clean up what was already collected.

The PII Audit: Finding Personal Data Leaking into GA4 Through URLs, Titles and Parameters

Why personal data in analytics is an audit item of its own

Most analytics audits ask whether the data is complete and correct. This one asks a different question: whether the property holds data it should never have received. Google's terms for Analytics prohibit sending personally identifiable information such as email addresses, phone numbers and full names, and privacy laws in the EU, India and a growing number of US states regulate that data wherever it lands. Customer emails in page paths are a contract problem and a compliance problem at once.

Almost nobody sends this data on purpose. It arrives as a side effect of how the website builds its URLs, how forms submit, and how tags were configured years ago. In our experience an unchecked property usually has some. This post covers where it leaks in, how to search for it, and what to do once you find it.

What counts as personal data here

The obvious items are email addresses, phone numbers, full names, postal addresses and government identifiers. The less obvious ones cause more arguments. A hashed email is still personal data under GDPR, because it is pseudonymised and not anonymous, and it belongs only in the features built for it, such as enhanced conversions. We cover the correct handling in hashing PII correctly on the server. An internal customer ID is generally fine as a GA4 user ID. An email address used as the user ID is not. Free text is the third group: anything a visitor can type, such as a search query or a form field, can contain an email address or a phone number.

The five places it leaks in

Nearly every finding in this audit traces back to one of five sources, so we check them in the same order every time:

  1. Page URLs. Query strings such as an email parameter on a thank-you page, a password reset link, an unsubscribe link from the email platform, or a form that submits with the GET method and puts every field into the address bar. GA4 records the full URL in page_location, and the next page records it again in page_referrer.
  2. Page titles. Account and order pages that render a customer's name or a booking reference in the title, which GA4 collects automatically with every page view.
  3. Site search terms. Enhanced measurement captures the search query parameter, so anything typed into the search box becomes a search_term value.
  4. Custom event parameters and user properties. A form tracking tag that passes field values instead of field names, a data layer push that includes the whole customer object, or a user property someone named email years ago.
  5. Identifiers. A user ID set to an email or phone number, or a transaction ID built from the customer's phone number.

Every one of these also travels beyond GA4. Advertising pixels read the same page URL and data layer, so a leak found in analytics is usually a leak into the ad platforms as well.

Searching the GA4 interface

In a free-form exploration, add page path and query string as the dimension, then filter with a regular expression that matches an at sign, its URL-encoded form %40, and the parameter names your own platform uses, such as email, phone, mobile, name and token. Run the same filter against page title, page referrer and search term.

Explorations only cover dimensions that exist in the interface, so repeat the exercise for every registered custom dimension, both event-scoped and user-scoped. That takes a while, which is why this check gets skipped in a normal quarterly analytics audit and deserves its own slot once or twice a year. Record each hit with the dimension, a masked example value, the date range and the event count.

Searching the BigQuery export

If the property exports to BigQuery, the search becomes thorough instead of limited to what the interface exposes. Unnest the event parameters and test every string value against patterns for an email address, a long run of digits that looks like a phone number, and your known risky parameter names. Do the same for user properties and for the user ID column. Group the results by event name and parameter key and you have a map of what leaked, through which event, and since when.

Two cautions apply. The export is itself a copy of the personal data, so the audit has to cover the warehouse and everything modelled from it. And expect false positives: a mailto link click carries your own support address, and order numbers can look like phone numbers. Teams that planned their export, as we recommend in what to model before you flip the switch, have fewer downstream tables to check.

Fixing the source before the symptom

The durable fix is always at the website. Change forms from GET to POST, stop putting email addresses in redirect and confirmation URLs, replace personalised page titles with generic ones, and have the email platform link with an opaque token instead of the address. These are small developer tasks once the exact URL patterns are written down, and they stop the leak for every tag on the page at once.

Where the website cannot change quickly, clean the data in the tag layer. In GTM, a custom variable can strip named query parameters from the URL before any tag reads it, and the GA4 tag can send that cleaned value as page_location. With a server container, a transformation can remove or rewrite parameters for every destination in one place, which we describe in server-side GTM transformations.

GA4 data redaction as a safety net

GA4 web data streams include a redact data setting that removes text resembling an email address and strips the query parameters you list, before the event is collected. Turn it on and add your known risky parameter names to the list.

Treat it as a net and not as the fix. It is pattern-based, it applies only to web streams, it does nothing for a name in a custom parameter, and it has no effect on the advertising pixels that read the same URL.

Cleaning up what was already collected

Stopping new collection leaves the history. GA4 has data deletion requests in the admin area, which remove the text of chosen parameters across a date range, either for all events or for the events you select. A request has a preview period before it becomes final, so check the preview carefully. Deletion removes the parameter values on every matching event in that range, not only the rows with personal data, so scope it as narrowly as the finding allows.

Deletion in GA4 does not reach data already exported. BigQuery tables, dashboard extracts, spreadsheets and anything sent to ad platforms each need their own cleanup. This is also the point to bring in whoever owns privacy for the business. Whether a leak must be reported is a legal judgement, and the audit's job is to supply accurate facts: what data, which systems, which dates. Our GDPR audit for your tracking stack and the Google Signals and PII checklist cover the wider compliance picture.

Keeping it from coming back

Leaks return with new features. A new booking flow or email tool will reintroduce the same patterns unless something is watching. Three habits keep the property clean:

  1. Add a line to the tracking spec for every new form and flow stating that no field values and no personal query parameters may reach the data layer or the URL.
  2. Schedule the BigQuery pattern search to run daily and alert when it returns any row, so a new leak is a one-day cleanup instead of a one-year one.
  3. Include the URL and title check in release testing for any page behind a login or after a form.

Final thoughts

Personal data in analytics is rarely a decision anyone made. It is the residue of URLs, forms and tags doing what they were built to do. The audit is not complicated: five sources, two searches, a fix at the source, a safety net, and a cleanup of history.

Our analytics audits include a personal data sweep across GA4, GTM and the warehouse, and a free audit is the quickest way to find out whether your property has a problem.

Topics: data privacy, GA4 audit, PII compliance, BigQuery, PII redaction

More articles on the Samarth Analytics blog · Markdown version of this article