What Should Website Analytics Keep in Page URLs?

Learn how to remove personal data from analytics URLs by reviewing paths and parameters, filtering before collection, and checking provider-specific limits.

Published
Reading time
6 min read
What Should Website Analytics Keep in Page URLs?
On this page

Website URLs can quietly carry personal data: an email address in a path, a search term in a query string, or an account identifier added by an application. If analytics records the full page URL, that information may end up in reports and other systems that receive analytics events.

This guide explains how to find sensitive URL patterns, decide what analytics actually needs, and filter page URLs before collection. Provider settings and behavior change, so confirm the current documentation for your analytics product before relying on a specific control. Current provider documentation could not be independently verified for this article; no provider-specific setting is assumed below.

Key Takeaways

  • Check both URL paths and query strings. Either can contain personal data or account-specific values.
  • Prefer an allowlist of page categories and safe parameters over trying to recognize every sensitive value.
  • Apply filtering before analytics events are sent, and check every event field that might contain a URL.
  • Cleaning a report or changing a filter does not necessarily erase data already collected.
  • Review analytics alongside logs, session replay, error monitoring, and other systems that may receive URLs.

How sensitive data gets into URLs

A URL consists of several parts, and more than one may need attention:

https://www.example.test/search?q=medical+condition&campaign=spring#results

The path may expose data too:

https://www.example.test/account/alex@example.test/settings
https://www.example.test/invite/7f2a91c0-21d8-4bc1-9c40-example

Common sources include:

  • Search boxes that put users’ terms in a q, search, or similar parameter.
  • Password-reset, invitation, or sign-in links containing tokens.
  • Application routes containing email addresses, usernames, customer numbers, or record IDs.
  • Filters or form values encoded in query parameters.
  • Campaign and referral parameters that may contain free-text values.

A URL fragment—the portion after #—is not sent in an HTTP request to the server. But JavaScript running on the page can read it, and analytics implementations may include it if they collect the browser’s full URL. Check the actual event payload rather than assuming fragments are excluded.

Advertisement

Review URL patterns before analytics collection

Use a small inventory of real, sanitized examples from your application. Do not paste live reset links, tokens, or customer URLs into shared tickets or documents. For each page type, ask:

  1. Which path segments are variable? Look for names, email addresses, account or record IDs, and opaque tokens.
  2. What query parameters are present? Identify search terms, form values, identifiers, and values that users can control.
  3. Can values contain personal data unexpectedly? A parameter called campaign may still be unsafe if its value accepts arbitrary text.
  4. What does the analytics event actually send? Inspect the outgoing event in a test environment, including custom dimensions and event parameters.
  5. Where else does the URL go? Check server and CDN logs, error trackers, session replay, and other analytics integrations.
  6. What does the business need? Usually, page categories and a few bounded values are more useful than a complete, user-specific URL.

Write the decision down as a rule for each route family: keep, transform, or drop. Include an owner and a review date, especially for routes that handle authentication, search, payments, or user-generated content.

Transform URLs before sending page-view events

A safer default is to send a limited page category instead of the browser’s complete URL. For example, the following illustrative JavaScript maps known routes to fixed labels, drops query strings and fragments, and assigns unexpected routes to a generic category:

const siteOrigin = "https://www.example.test";

function analyticsPagePath(rawUrl) {
  const url = new URL(rawUrl, siteOrigin);

  if (url.origin !== siteOrigin) {
    return "/other";
  }

  if (url.pathname === "/") {
    return "/";
  }

  // Use this mapping only if product routes cannot contain user-provided data.
  if (/^\/products\/[^/]+\/?$/.test(url.pathname)) {
    return "/products/:product";
  }

  if (url.pathname === "/search") {
    return "/search";
  }

  return "/other";
}

console.log(
  analyticsPagePath("https://www.example.test/search?q=private+search#results")
);
// "/search"

This is a transformation example, not a complete analytics integration. It must be applied to the value your analytics event actually uses, before that event is sent. Mapping a route to a template is safe only when its variable segment cannot itself contain sensitive data. If that cannot be established, use a more specific allowlist or map the route to a generic category.

If you need query parameters, allow only those with a clear purpose and controlled values. Avoid forwarding every parameter and attempting to blacklist a few known-bad names: new parameters can appear, and harmless-looking fields can carry free text. Check the current documentation for your analytics provider to confirm where its redaction or filtering controls act, which URL fields they cover, and whether the behavior applies before collection or only in later processing.

Advertisement

Check the complete data flow

A page-view setting may not cover URLs copied into custom event parameters, form events, exception messages, or session-replay tools. Test representative pages and inspect the network requests or provider’s debugging tools to see what leaves the browser. Use synthetic values in tests; do not generate real personal data or live credentials for this purpose.

Also check whether a single-page application sends page views during navigation. Its code may explicitly pass a new route to analytics even when the provider does not automatically read the browser address. Review redirects and third-party integrations as well as the initial page load.

Filtering new events does not guarantee removal of historical data. Previously collected URLs may remain in raw event data, exports, backups, or other destinations, depending on the service and your configuration. Use the provider’s documented deletion or retention processes where appropriate, and assess other copies separately. A URL-cleaning step is one part of data handling, not a substitute for a broader privacy review.

Common Mistakes

  • Checking only query strings. Sensitive values can be embedded in paths too.
  • Assuming a parameter name makes a value safe. Campaign, referral, and custom parameters can contain arbitrary text.
  • Keeping a route because it looks public. Slugs and identifiers may be user-generated or linked to a person.
  • Treating report cleanup as collection-time filtering. A cleaner report view does not establish that the original event omitted the data.
  • Assuming one analytics setting covers every integration. Custom events, replay, logs, and error reporting may collect URLs separately.
  • Treating a URL parser or cleaner as a privacy control. Inspecting or formatting a URL does not prevent an application from sending it to analytics.

Best Practices

  • Default to excluding query strings and fragments unless a documented use case requires selected values.
  • Map dynamic routes to fixed page categories, and send only bounded, reviewed values.
  • Review changes to routes and analytics event code as part of release testing.
  • Verify the actual outgoing payload in a test environment and repeat the check after configuration changes.
  • Consult current provider documentation for the exact scope, timing, and limitations of its redaction controls.
  • Document retention and deletion steps for data that was already collected, and include other systems that receive URLs in the privacy assessment.

Conclusion

Analytics usually needs to know what kind of page was viewed, not the complete URL a particular person visited. Inventory sensitive patterns, transform URLs before events leave the site, verify the payload, and treat historical data and other URL-collecting systems as separate parts of the review.

What would your domain sell for?

A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.