UTMs or gclid lost in a redirect: how to test and fix it

Published by the UTM Builder team at Limner.

When the ad URL goes through a redirect that doesn’t pass the query string along, the final page opens without UTMs or gclid, and GA4 records the visit as (direct) / (none). To test it, open the real link and look at each hop. The fix is usually a rule in the server, the plugin or the URL shortener.

Where the UTM gets lost

GA4’s help page on direct traffic lists redirects from one site to another or from https to http, and URL shorteners such as bit.ly, among the things that can strip parameters. The usual suspects:

The gclid alert in Google Ads

Google Ads has its own alert for this: "Website redirects are losing click data". The help page explains that it appears when redirects don’t pass the GCLID along and that, without it, the click isn’t associated with any future conversion. The auto-tagging page says the same: if your site uses redirects, the GCLID has to reach the final landing page.

The same page covers sites that return an error when they receive parameters: turn off auto-tagging, ask your developer to allow arbitrary URL parameters, and only then turn it back on.

How to test

  1. Copy the link exactly as it is in the ad, the bio or the email. For Google Ads, add gclid=teste123 to the final URL, with ? or & as needed.
  2. In Chrome, open DevTools, go to the Network panel and check Preserve log, which keeps requests across page loads.
  3. Open the link. Click each 301, 302, 307 or 308 response and look for the Location header under Response Headers. The parameters have to be there at every hop.
  4. On the final page, check the address bar and see whether the visit shows up in GA4’s Realtime report.
  5. Repeat on your phone and inside the app where the link will be shared.
http://loja.com.br/promo?utm_source=teste&utm_medium=teste&utm_campaign=teste-redirect&gclid=teste123

Start with http:// and no www on purpose: that way the test goes through the hops the server adds on its own.

How to fix it

nginx: return 301 https://www.loja.com.br$request_uri;
apache: RewriteRule "^promo$" "/oferta?ref=site" [R=301,L,QSA]

Official sources