← Back to blog

The Analytics Data Leak Hiding in Your URLs

Paths, query parameters, and page titles can leak personal data into analytics. A route allowlist protects more than a growing list of redaction rules.

An analytics event can expose personal data even when it contains no cookie or account ID. The leak may be the URL itself: a search query, an email address in a path, or a password-reset token in a query string.

The OWASP Top 10:2025 identifies sensitive information in logs as a security logging failure. Analytics is not the same thing as security logging, but the failure mode carries over: a field collected for measurement becomes another copy of information that should not have left the application.

Find the Data Before It Leaves

A URL has several independent surfaces: its path, query string, and fragment. Page titles, referrers, outbound-link destinations, and custom event properties can repeat the same information. Removing cookies does nothing to make those fields safe.

Google's own Analytics guidance warns that both URL paths and parameters can contain personal information, as can titles and search terms. Its email redaction is explicitly best effort; configured query-parameter redaction applies to web streams but does not inspect HTTP headers or protect data sent through every ingestion method. A dashboard setting is therefore not a complete collection policy.

Start with a data map. For each pageview and event, record the browser value read, the value actually sent, every server-side transformation, and the fields written to storage and logs. Inspect network requests as well as database rows: deleting a value after ingestion does not undo its transmission.

Send Route Names, Not Raw URLs

The safest default is a route allowlist: map known pages to fixed labels such as /pricing, /articles/:slug, or /account/reset, and discard unmatched routes. The labels are examples, not a rule that arbitrary slugs are safe. If a slug can contain a person's name or an invitation token, substitute a constant route template instead.

Drop query strings and fragments by default. If a business question really requires a campaign dimension, accept only predefined keys and predefined values, such as a controlled channel category; a permitted key with a free-form value can still carry an email or token. Never send search terms, reset tokens, email addresses, or user-generated titles as analytics dimensions.

Apply the mapping in the browser before transmission, then validate the resulting event again at the collector. Reject unexpected fields and values rather than trusting every caller to use your tracker. This is a general design pattern, not a claim that any particular analytics product implements this exact allowlist.

Treat Logs and Existing Data Separately

An ingestion endpoint, reverse proxy, error reporter, or debugging tool can record data independently of the analytics table. Review those paths too, including request bodies and URLs, and avoid logging sensitive values. Keep security events useful by recording the event type and outcome rather than copying an entire request.

Changing the tracker only protects future events. Identify existing exports, replicas, backups, and third-party destinations; determine what can be deleted or expired, and document exceptions. A secret that has already appeared in telemetry should be revoked or rotated, not merely hidden in a dashboard.

Test the Boundary

Use synthetic addresses and fake tokens in test routes, query parameters, fragments, titles, and referrers. Check browser network traffic, collector rejection, logs, stored events, and downstream exports; include malformed encoding and unexpected route segments. Never use real credentials for these tests.

Repeat the tests when routes, campaign links, or event schemas change. A privacy-first tracker reduces identity collection, but the application still owns the content it places in URLs; the useful boundary is the one that prevents sensitive values from being transmitted in the first place.

Sources

Comments

Loading comments…