Skip to content
FunnelGuard

Fix guide by FunnelsGuard

UTMs lost on redirect (http, www, trailing slash): how to fix

TRK-311High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

UTMs are tags added to a link, such as ?utm_source=google&utm_medium=cpc, that tell analytics where a visit came from. Click IDs like gclid (Google Ads) and fbclid (Meta) do a similar job for ad platforms. Together they are the query string.

Many sites redirect the first URL a visitor lands on to a canonical version: http:// to https://, example.com to www.example.com, or /pricing to /pricing/. If a redirect rule sends the visitor to the new address without the query string, the browser arrives at a clean URL. Your analytics and ad tags never see the parameters.

Where the UTMs disappear
  1. Ad clickhttp://example.com/offer?utm_source=google&gclid=abc
  2. Redirect301 to https://www.example.com/offer/ with no query string
  3. Landing pageURL has no UTMs or gclid
  4. ConversionRecorded as direct or unassigned

The redirect hop removes the query string, so everything after it sees a visit with no campaign data.

Why it costs you leads or sales

The visitor still lands and may still convert, so nothing looks broken. What breaks is the credit. Paid conversions are attributed to direct or organic, and Google Ads or Meta may not receive the click ID needed to match a conversion to an ad.

Reports then say the campaign does not work. You cut budget on channels that were performing, and bidding algorithms learn from fewer conversions. The cost is wasted spend and wrong decisions, not an error message.

Paid conversions reported in analyticsExample numbers
Paid conversions reported in analytics (example)Actual paid conversions: 100 conversions; Credited to paid (broken redirect): 35 conversions; Credited to paid (fixed): 100 conversions0387710035100Actual paid conversio…Credited to paid (bro…Credited to paid (fix…conversions

Example: 100 real conversions from paid clicks. With a redirect that strips the query string, most appear as direct.

How to check if your site has it

Test every variation a visitor or an old ad link could use, not just the final URL. Add a fake parameter so you can see what survives.

Test redirects by hand
  1. Build test URLs

    Use the http and https versions, with and without www, with and without a trailing slash, each ending in ?utm_source=test&utm_medium=cpc&gclid=test123.

  2. Open each one in a browser

    Look at the address bar after the page loads. If the parameters are gone, that redirect is stripping them.

  3. Inspect the redirect chain

    Run the command below, or use the Network tab in your browser's developer tools with Preserve log on. Check the Location header of each hop.

  4. Test your real ad URLs

    Copy the final URLs from your ad platforms, including any tracking templates, and repeat the test.

Follow redirects and print each Location headerbash
curl -sIL "http://example.com/offer?utm_source=test&gclid=test123" | grep -iE "^(HTTP|location)"

How to fix it

The principle is the same everywhere: the redirect must append the original query string, and there should be as few hops as possible. Where you set that depends on your platform.

Keep the query string on redirects
  1. Check the site address

    In Settings > General, make sure WordPress Address and Site Address use https and your preferred www or non-www version. WordPress then handles most canonical redirects and keeps the query string.

  2. Review redirect plugins

    In plugins such as Redirection or Yoast Premium, open each rule and turn on the option to pass through or ignore query parameters. Avoid rules that redirect to a fixed target URL without it.

  3. Check server rules and the SSL plugin

    If a force-https plugin or your host's setting adds a second redirect, switch to a single server-level rule (see the Custom code tab).

nginx: one hop to https and www, query string keptnginx
server {
  listen 80;
  server_name example.com www.example.com;
  return 301 https://www.example.com$request_uri;
}

server {
  listen 443 ssl;
  server_name example.com;
  # ssl_certificate lines here
  return 301 https://www.example.com$request_uri;
}
Apache .htaccess: https and www, query string kepthtaccess
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301,QSA]
Redirect behaviour

Before

  • http://example.com/offer?utm_source=google redirects to https://www.example.com/offer/
  • Two or three hops in a chain
  • Landing page URL has no parameters
  • Conversions show as direct

After

  • One 301 to https://www.example.com/offer/?utm_source=google
  • Query string kept on every hop
  • Landing page sees UTMs and gclid
  • Conversions credited to the campaign

How to confirm it's fixed

Confirmation checklist
  • Every http, www and trailing slash variation of a test URL ends on the final URL with utm_source, utm_medium and gclid intact
  • The curl command shows a single redirect hop, or a chain where each Location keeps the query string
  • In GA4 Realtime, a visit using your test UTMs shows the right source and medium
  • Your ad platform's landing page URL test or tag diagnostics show the click ID arriving
  • Old ad, email and social links tested too, not just the main landing page
See what a redirect does to your UTMsInteractive
Redirect strips the query string

Ad click → yoursite.com/offer?gclid=Cj0KCQ…&utm_source=google&utm_campaign=spring

301 redirect

Lands on → yoursite.com/offer/

  • gclid
  • utm_source
  • utm_campaign

The visitor lands on a clean URL. GA4 and ad tags see no UTMs or gclid, and the conversion is reported as direct.

Toggle the redirect behaviour to compare the attribution result.

How to prevent it happening again

Prevention habits
  • Keep one canonical URL pattern (https, one host, one slash style) and use it in every ad and email
  • Re-test redirects with a query string after any migration, SSL change, CDN change or new redirect plugin
  • Keep redirect rules in one place so no second layer adds a hop
  • Test a sample tagged URL whenever you launch a new campaign
  • Ask developers to review any rule that ends in ? or sets a fixed target

How FunnelGuard handles this

FunnelGuard detects this issue today with its UTM persistence check. A robot visitor opens your landing page with marked test parameters (the test traffic uses utm_source=funnelguard and fg_test=1) and checks whether the campaign data is still present after any redirects and as the journey continues.

If a check fails, FunnelGuard re-checks from a second region before sending one alert by email, Slack, Teams, WhatsApp, webhook or PagerDuty, with a screenshot and a likely cause. It does not fix your redirects for you. You still make the change, and the next scheduled run shows whether it worked. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans include a 3-day free trial.

Questions people ask

Why are my UTM parameters disappearing after a redirect?

The redirect rule probably sends visitors to the new URL without the query string. This often happens with http to https, non-www to www, or trailing slash rules, or with redirect plugins that use a fixed target. Test with curl or your browser's Network tab to see which hop drops the parameters.

Does an http to https redirect remove UTMs?

It should not. A correctly configured redirect keeps the query string, for example return 301 https://www.example.com$request_uri; in nginx. If your UTMs vanish, a custom rule or a plugin is replacing the URL instead of passing the query string on.

How do I keep the query string in a 301 redirect?

Append the original query string to the target. In nginx use $request_uri, in Apache add the QSA flag and avoid a trailing ?, and in redirect plugins or platform settings turn on the pass-through option for query parameters. Then test with a tagged URL.

Can Google Tag Manager recover UTMs lost in a redirect?

No. GTM runs after the page has loaded, so if the redirect already removed the parameters, there is nothing left to read. Fix the redirect, then use GTM to store UTMs on arrival if you want them to persist across later pages.

Why does my paid traffic show as direct in GA4?

A common cause is that UTMs or gclid were stripped before GA4 loaded, usually by a redirect. Other causes include missing tags on email or SMS links, or links that cross domains. Test your landing URLs with parameters to rule out redirects first.

Should I point ads at the final URL instead of a redirecting one?

Yes. Using the exact canonical URL (https, the right host and slash style) removes the redirect hop, so there is nothing to strip the parameters. It is also faster for visitors.

How can I monitor UTM loss on redirects automatically?

FunnelGuard runs a UTM persistence check on a schedule. It loads your landing page with marked test parameters and alerts you when they do not survive. You can start with the Free plan, which has 1 site and 2 journeys with daily checks.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: utm_persistence.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.