Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Cache stripping UTM and gclid parameters: how to find and fix it

OPS-111High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Ad platforms add query parameters to your link, such as ?utm_source=google&utm_campaign=spring or ?gclid=abc123. Your analytics and ad tags read them from the page address when the visitor lands.

Caching layers sit between the visitor and your site. Some are set to ignore the query string so one cached copy serves every URL, and some redirect to a clean URL to do it. If that redirect drops the parameters, or the cache rule rewrites the address, the tags never see the campaign data.

Why it costs you leads or sales

When parameters vanish, paid clicks are credited to direct traffic or the wrong channel. Conversions can't be matched to the campaign, so reports undercount ad results, and Google Ads can't import offline or click-based conversions that rely on gclid.

The result is bad decisions: you cut campaigns that work, or bidding algorithms learn from incomplete data. The site looks fine to visitors, so nobody notices for weeks.

Where the parameters get lost
  1. Ad clickURL has ?gclid and utm_*
  2. CDN / cacheRedirects to clean URL
  3. Landing pageURL has no parameters
  4. Analytics and ad tagsVisit logged as direct

The cache or redirect removes the query string before the tags run.

Paid visits credited to the right campaignExample numbers
Paid visits credited to the right campaign (example)Before fix: 35 %; After fix: 95 %036733595Before fixAfter fix%

Example: share of paid clicks attributed to their campaign before and after fixing a cache rule.

How to check if your site has it

Test a tagged URL by hand
  1. Build a test URL

    Add parameters to your landing page, for example https://example.com/landing?utm_source=test&utm_medium=cpc&utm_campaign=cachecheck&gclid=TEST123

  2. Open it in a private window

    Watch the address bar after the page loads. If the parameters disappear or the URL changes, something is redirecting or rewriting it.

  3. Check the response headers

    In browser DevTools, open Network, click the first request and look for a 301 or 302 status and a Location header. Also look at cf-cache-status, x-cache or x-litespeed-cache.

  4. Check the tags

    In GA4 DebugView or the Network tab, confirm the page_view hit includes the campaign values (look for dl= with the full URL, or the campaign fields).

See whether a redirect drops the parametersbash
curl -sI "https://example.com/landing?utm_source=test&gclid=TEST123" | grep -iE "^(HTTP|location|cf-cache-status|x-cache)"

How to fix it

The goal: the visitor's browser must still have the full URL when your tags run. A cache can ignore query strings for its cache key, which is fine, as long as it does not redirect or rewrite the address.

Fix by platform
  1. Open your caching plugin settings

    In WP Rocket, check Advanced Rules > Cache Query Strings and the Never Cache URL list. In LiteSpeed Cache, review Cache > Excludes > Drop Query String, and remove utm_* and gclid from any strip list that redirects.

  2. Do not redirect to a clean URL

    Plugins that 'ignore' marketing parameters should serve the cached page and leave the address alone. If a setting redirects, turn it off.

  3. Purge the cache

    Clear the plugin cache and any host-level cache, then retest.

Nginx: keep query strings on a redirectnginx
location = /old-landing {
  return 301 /new-landing$is_args$args;
}
Apache: keep query strings on a rewritehtaccess
RewriteEngine On
RewriteRule ^old-landing/?$ /new-landing [R=301,L,QSA]
Cache behaviour

Broken

  • Cache redirects /landing?gclid=... to /landing
  • Tags see a URL with no parameters
  • Paid visits show as direct

Fixed

  • Cache serves one copy but leaves the URL unchanged
  • Tags read utm_* and gclid on load
  • Visits credited to the right campaign

How to confirm it's fixed

Confirmation checks
  • A tagged URL keeps its full query string in the address bar after loading
  • curl shows no redirect, or a redirect whose Location includes the parameters
  • GA4 DebugView shows the right source, medium and campaign
  • The gclid reaches Google Ads tags (check the Network tab for the conversion hit)
  • Test a second time on a cached response (cf-cache-status: HIT) so you know the cached copy behaves too

How to prevent it happening again

Cache and redirect settings change quietly: a plugin update, a new CDN rule, a host migration. Keep a short note of which layer handles query strings. After any change to caching, redirects or the CDN, rerun a tagged-URL test on your main landing pages.

How FunnelGuard handles this

FunnelGuard detects this today. Its robot visitor lands on your page with marked test parameters (such as utm_source=funnelguard) and checks whether they are still present when the journey runs and when tracking hits go out. If the parameters are lost along the way, the utm_lost check fails.

A failure is re-checked from a second region, then you get one alert (email, Slack, Teams, WhatsApp, webhook or PagerDuty) with a screenshot and a likely cause. The Free plan covers 1 site and 2 journeys with daily checks and no card. A free read-only website audit is also available.

Questions people ask

Why are my UTM parameters not showing in Google Analytics?

Often something between the ad click and your page removes them, such as a CDN redirect, a caching plugin or a URL rewrite rule. Load a tagged URL in a private window and see whether the query string survives. If it disappears, fix the redirect or cache rule.

Does Cloudflare strip UTM parameters?

Cloudflare does not strip them by default. A Redirect Rule, Transform Rule or Worker that removes or rewrites the query string can. Ignoring the query string in the cache key is fine, as long as the visitor's URL stays unchanged.

Why is my gclid missing from the landing page URL?

A redirect or cache rule is probably dropping it before the page loads. Check with curl -I and look at the Location header. Also check that auto-tagging is on in Google Ads.

How do I stop a caching plugin removing tracking parameters?

Open the plugin's query string settings and remove utm_* and gclid from any list that triggers a redirect or strips the URL. Then purge the cache and test again with a tagged link.

Is it safe for a cache to ignore UTM parameters?

Yes, if it only ignores them when choosing which cached copy to serve. That lets all campaign links share one page. It becomes a problem when the cache redirects or rewrites the visitor's address.

How can I tell if paid traffic is being counted as direct?

Compare ad platform clicks with GA4 sessions by campaign. If clicks are steady but direct or unassigned traffic rises, parameters are likely being lost. A tagged test URL confirms it.

Can FunnelGuard detect lost UTM parameters?

Yes. It visits your page with marked test parameters and flags the utm_lost check if they are gone when the journey runs. You are alerted once after a second-region re-check.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: utm_lost.

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.