Skip to main content

Google Analytics Implementation: Query parameters persist through redirects

A guide to ensuring marketing tracking data (like UTMs) survives server-side redirects to maintain accurate attribution in Google Analytics.

Written by Luiza Gircoveanu
Updated today

Overview

This check validates that any query parameters attached to an incoming URL (such as utm_source, utm_medium, or gclid) are preserved when a page performs a redirect (e.g., a 301 or 302 redirect). When a user clicks a link that redirects—such as a shortened vanity URL or a legacy page moving to a new path—the server must explicitly "pass through" these parameters to the destination URL so that Google Analytics can read them.

Why it is important

Redirects are the most common "silent killer" of marketing attribution:

  • Attribution Loss: If a redirect strips the utm parameters, Google Analytics will see the visit as "Direct" traffic. This makes your paid search, email, and social campaigns appear far less effective than they actually are.

  • Loss of Ad Click Data: For Google Ads, the gclid parameter must persist. If it is dropped during a redirect, Google Analytics cannot link the session back to the specific ad click, breaking your ROAS (Return on Ad Spend) calculations.

  • Fragmented User Journeys: Missing parameters can cause Google Analytics to start a new session upon landing at the final destination, inflating session counts and confusing pathing analysis.

Implementation

We have made implementing this check for parameter persistence simple.

  1. Create an Audit and copy and paste a list of URLs with query parameters in the starting URL field,

  2. Toggle on scan only starting URLs, then consume the report;

  3. Check the pre-built ObservePoint report for Pages that lose query parameters after redirects.

Remediation

If query parameters are being lost during redirects, work with your web development or DevOps team to apply these fixes:

  • Update Redirect Rules: Ensure that server-side redirect rules (in .htaccess, Nginx, or your CDN) are configured to append the original query string to the destination. (e.g., in Apache, use the QSA flag: [R=301,L,QSA]).

  • Audit Vanity URLs: Shortened links or marketing "vanity" URLs often fail to pass parameters. Ensure the redirection service used (like Bitly or an internal tool) is set to forward all query parameters.

  • Check JavaScript Redirects: If the redirect is happening via JavaScript (window.location.href), ensure the script is written to capture window.location.search and append it to the new URL.

  • Review Protocol Switches: Sometimes parameters are lost when a site redirects from http to https. Ensure your global SSL redirect rule is "query string aware."

Conclusion

Query parameters are the "identity tags" of your marketing traffic. If they are stripped during a redirect, your marketing data becomes blind. By using ObservePoint to monitor the entire redirect chain, you ensure that your attribution data remains intact from the first click to the final landing page, protecting the integrity of your marketing ROI reports.

Did this answer your question?