Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Cache busted by UTM and gclid params: how to fix it

PRF-054High impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

A page cache stores a ready-made copy of a page so the server does not have to build it again for each visitor. To find the right copy, the cache uses a cache key. By default the key is usually the full URL, including everything after the ?.

Paid ads add parameters to your links: utm_source, utm_campaign, gclid (Google Ads), fbclid (Meta), msclkid (Bing), ttclid (TikTok) and others. Click IDs are unique per click. So /landing?gclid=abc and /landing?gclid=xyz are two different keys, and neither has a stored copy. Each ad visitor triggers a full page build on the origin. Your cache works for organic visitors on the clean URL and does almost nothing for paid traffic.

Why it costs you leads or sales

Ad visitors are the traffic you pay for. If they get the slowest version of your page, you pay for clicks that leave before the page loads. The origin also does extra work during a campaign launch, exactly when many people arrive at once. That can push response times up for everyone and, under heavy load, cause errors.

The problem is easy to miss. You test the clean URL, it is fast, and the cache looks healthy. Only the tagged URL is slow.

What happens to an ad click
  1. Ad clickURL ends in ?gclid=unique-id
  2. Cache lookupKey includes the gclid, so no copy is found
  3. Origin builds pagePHP and database work on every visit
  4. Slow first byteVisitor waits, some leave

The unique gclid makes the URL a cache miss, so the origin builds the page every time.

Time to first byte: clean URL vs tagged URLExample numbers
Time to first byte: clean URL vs tagged URL (example)Clean URL (cache hit): 90 ms; Tagged URL (cache miss): 1,100 ms0422843901,100Clean URL (cache hit)Tagged URL (cache mis…ms

Example: illustrative numbers for a site where the cache ignores nothing. Your own values will differ.

How to check if your site has it

Request the same page with and without a tracking parameter and compare the cache headers and the time to first byte (TTFB, the wait before the first data arrives). Use a made-up value each time so you are not hitting a copy stored earlier.

Compare clean and tagged requestsbash
# Run each twice: the first request may fill the cache, the second shows the real result
for url in "https://example.com/landing/" "https://example.com/landing/?gclid=test$RANDOM"; do
  echo "== $url"
  curl -s -o /dev/null -D - -w 'TTFB: %{time_starttransfer}s\n' "$url" | grep -iE 'cache|age:|x-cache|cf-cache-status|x-varnish|TTFB'
done
Header values that suggest a cache miss on the tagged URL
HeaderClean URLTagged URL (problem)
cf-cache-status (Cloudflare)HITMISS or DYNAMIC
x-cache (CloudFront, Fastly, others)HitMiss
ageA number above 0Missing or 0
x-varnishTwo IDsOne ID
TTFBLowMuch higher

How to fix it

The goal is to ignore tracking parameters in the cache key, not to remove them from the URL. The browser still sees ?gclid=..., so your analytics and ad tags can read it. Only the cache lookup treats the URL as the clean page. Do this only for parameters that do not change page content. Never ignore parameters like ?product=12 or ?page=2.

Fix the cache key
  1. List your tracking parameters

    Typical ones: utm_source, utm_medium, utm_campaign, utm_term, utm_content, gclid, gbraid, wbraid, fbclid, msclkid, ttclid, li_fat_id. Add any custom ones your ad links use.

  2. Find where your page cache lives

    It may be a WordPress plugin, your host's built-in cache, a CDN such as Cloudflare, or a server layer such as Nginx or Varnish. Fix it at the layer that does the lookup. Several layers can each need the setting.

  3. Set that layer to ignore the parameters

    Use the platform tabs below for common setups.

  4. Keep dynamic parameters out of the ignore list

    Only list parameters that never change what the page shows.

  5. Purge the cache and retest

    Clear the cache after the change, then repeat the curl comparison.

Ignore tracking parameters by platform
  1. Check your cache plugin's query string setting

    Many cache plugins (for example WP Rocket, LiteSpeed Cache, W3 Total Cache) have a list of query strings to ignore or exclude from bypass. Add your tracking parameters there. WP Rocket ignores common ones such as utm_ and gclid by default in recent versions, but confirm in its settings and add custom ones. Menu names differ by plugin and version.

  2. Check the host cache too

    Managed WordPress hosts often run their own server cache. Check the host's dashboard or support docs for a way to ignore query parameters.

Nginx: cache key without the query string (static marketing pages only)nginx
# Use only for pages whose content does not depend on any query parameter
proxy_cache_key "$scheme$host$uri";
Varnish VCL: strip tracking parameters before lookuptext
sub vcl_recv {
  if (req.url ~ "(\?|&)(utm_[a-z]+|gclid|gbraid|wbraid|fbclid|msclkid|ttclid)=") {
    set req.url = regsuball(req.url, "(utm_[a-z]+|gclid|gbraid|wbraid|fbclid|msclkid|ttclid)=[^&]*&?", "");
    set req.url = regsub(req.url, "[?&]+$", "");
  }
}
Cache behaviour for ad clicks

Before

  • Each gclid or fbclid creates a new cache key
  • Ad visitors always reach the origin
  • Slow first byte on paid traffic
  • Origin load climbs during campaigns

After

  • Tracking parameters ignored in the cache key
  • Ad visitors get the cached copy
  • First byte close to the clean URL
  • Parameters still in the URL for analytics

How to confirm it's fixed

Confirmation checks
  • Purge the cache after changing the rule
  • Request the tagged URL twice with a fresh gclid value; the second response should show a cache hit or an age header
  • TTFB for the tagged URL is close to the clean URL
  • Open the tagged URL in a browser; the parameter is still in the address bar
  • In your analytics real-time view, the visit still shows the campaign source and the click ID is still captured
  • A URL with a content-changing parameter (such as ?page=2) still shows the right content

How to prevent it happening again

New ad platforms bring new click ID parameters, so the ignore list goes out of date. Review it whenever you start advertising on a new network. Also recheck after you switch host, CDN or cache plugin, because the setting often does not carry over.

Prevention habits
  • Add the cache comparison to your campaign launch checklist
  • Keep a written list of the tracking parameters your ads use
  • Retest after changing hosting, CDN rules or cache plugins
  • Use the tagged URL, not just the clean one, when you run speed tests
  • Keep dynamic parameters (search, filters, pagination) out of the ignore list

How FunnelGuard handles this

FunnelGuard does not check this yet. Comparing response time with and without tracking parameters is a possible future check, but today it is not part of the service.

What FunnelGuard does do is run your real customer journeys on a schedule, from the EU or the US, with test traffic marked with utm_source=funnelguard and fg_test=1. It checks each step of the journey, the tracking hits sent to ad and analytics platforms, and whether test leads reach your inbox and CRM. A failure is re-checked from a second region before one alert is sent with a screenshot and a likely cause. That tells you if a journey breaks, but it does not tell you that ad traffic is missing the cache.

To watch for this issue yourself, rerun the curl comparison above after every cache, CDN or hosting change and before each campaign launch. You can also use any speed testing tool that lets you enter a full URL with parameters, and compare it to the clean URL. The Free plan (1 site, 2 journeys, daily checks, no card) and a free read-only website audit are available if you want help watching the funnel itself.

Questions people ask

Why is my landing page slow only when visitors come from ads?

Ad links add parameters such as gclid or fbclid, and many caches treat each unique URL as a separate page. The ad visitor misses the cache and the server builds the page from scratch. Compare the TTFB of the clean URL and a tagged URL to confirm.

Do UTM parameters break caching?

They can. If the cache key includes the full URL, every different UTM combination is a separate entry, so it may need to be built once per combination. Because gclid and fbclid are unique per click, those almost always miss. Configure the cache to ignore tracking parameters.

How do I make my cache ignore gclid and utm parameters?

Add the parameters to the ignore or exclude list in your cache layer. In Cloudflare, use a Cache Rule and set the query string option to exclude them. In a WordPress cache plugin, look for its ignored query strings setting. In Nginx, build the cache key from $uri only.

Will ignoring query parameters in the cache stop Google Ads tracking?

No, as long as the parameters stay in the browser URL. The cache ignores them only when choosing the stored copy, and your tags still read them in the page. Avoid redirects that strip the parameters, as they can lose the click ID.

How can I test if a URL with gclid is cached?

Run curl with a made-up gclid value twice and look at the cache headers, such as cf-cache-status, x-cache or age. A second request showing HIT or an age above 0 means it is cached. Also compare TTFB with the clean URL.

Is it safe to ignore all query parameters in the cache?

No. Parameters like search terms, filters, page numbers or product IDs change what the page shows. Ignore only the tracking parameters that never change content, or visitors may see the wrong page.

Does FunnelGuard detect cache misses from tracking parameters?

No. FunnelGuard does not check this yet, though it is a possible future check. It does run your funnel journeys and tracking checks on a schedule. For cache behaviour, compare tagged and clean URLs manually.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

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.