Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Landing page cache varies on query string: how to fix it

TRK-323Low impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

A cache stores a ready-made copy of a page so the server does not rebuild it for every visitor. To find that copy, the cache uses a cache key, usually the URL. If the key includes the query string (the part after ?), then every different combination of parameters is a different key.

Ad clicks carry parameters that are unique or nearly unique: gclid, fbclid, msclkid, ttclid, and campaign tags like utm_campaign. Some setups never cache URLs with a query string at all. Others cache each variant once, so the cache fills with copies that are hit a single time.

Why it costs you leads or sales

Paid traffic is the traffic you pay for per click, and it is the traffic most likely to skip the cache. Those visitors wait for the server to build the page, which is slower, and under a traffic spike from a campaign launch the server can slow down or time out. Slower landing pages tend to lose more visitors before the form loads. The effect is usually modest, which is why this issue is rated low impact, but it adds up on busy campaigns.

How a tagged ad click skips the cache
  1. Ad clickURL has ?gclid=... and utm tags
  2. Cache lookupFull URL is the key, no match
  3. Origin serverBuilds the page from scratch
  4. Slow pageVisitor waits, may leave

The cache sees a new URL, so the origin server builds the page every time.

Page response time by cache resultExample numbers
Page response time by cache result (example)Cache hit: 80 ms; Cache miss (tagged URL): 900 ms034569080900Cache hitCache miss (tagged UR…ms

Example: illustrative response times, not measured data. Your numbers will differ.

How to check if your site has it

Test whether tagged URLs are cached
  1. Request the plain URL twice

    Run curl -sI https://example.com/offer twice and look at the cache headers.

  2. Request a tagged URL twice

    Run curl -sI "https://example.com/offer?utm_source=test&gclid=abc123" twice. Use a new gclid value for a third request.

  3. Compare the headers

    Look for cf-cache-status, x-cache, x-cache-status, x-litespeed-cache, age or similar. A plain URL showing HIT while the tagged URL shows MISS, BYPASS or DYNAMIC means the query string is part of the key.

  4. Check a new value

    If the first tagged request is a MISS and the repeat is a HIT, but changing gclid gives a MISS again, each value is cached separately.

Compare cache headersbash
curl -sI https://example.com/offer | grep -i -E 'cache|age'
curl -sI "https://example.com/offer?utm_source=test&gclid=abc123" | grep -i -E 'cache|age'

How to fix it

The goal is to ignore tracking parameters in the cache key while still passing them to the browser. Analytics scripts read the parameters in the browser, so tracking keeps working. Only ignore parameters that do not change the page content. Keep any parameter that does, such as a language or product ID.

Ignore tracking parameters in the cache
  1. Open your caching plugin settings

    Most caching plugins have a list of query strings to ignore, often called ignored or excluded query strings. WP Rocket, LiteSpeed Cache and W3 Total Cache all have a setting for this, but names and defaults vary by version, so check your plugin's documentation.

  2. Add tracking parameters

    Add utm_source, utm_medium, utm_campaign, utm_term, utm_content, gclid, fbclid, msclkid and ttclid to the ignore list, then clear the cache.

  3. Check host-level caching

    If your host runs its own page cache, ask them how to ignore these parameters there too.

If you use a CDN such as Cloudflare, Fastly or CloudFront, the same idea applies at the CDN level. Look for a cache key or cache rule setting that lets you ignore or exclude specific query parameters. Names differ by provider and plan, so check their documentation.

Nginx: strip tracking parameters from the cache keynginx
# http block
map $args $clean_args {
    default $args;
    ~^(.*?)(?:^|&)(?:utm_[a-z]+|gclid|fbclid|msclkid|ttclid)=[^&]*(.*)$ $1$2;
}

# Simple alternative: if a page never needs any query string,
# key the cache on the path only.
fastcgi_cache_key "$scheme$request_method$host$uri";

How to confirm it's fixed

After the change
  • A tagged URL with a new gclid value returns a cache HIT on its second request.
  • The plain URL and the tagged URL return the same content.
  • UTMs and click IDs are still in the address bar after the page loads.
  • Your analytics real-time view still shows the campaign source for a test visit.
  • Server load on the landing page falls during the next campaign burst.

How to prevent it happening again

Habits that keep it fixed
  • Keep one shared list of tracking parameters and update the cache rule when you add a new ad platform.
  • Re-run the curl comparison after changing host, CDN, caching plugin or theme.
  • Test a tagged URL, not just the plain one, before every campaign launch.
  • Document the cache rules so an agency or developer change does not undo them.

How FunnelGuard handles this

This issue is outside what FunnelGuard checks. FunnelGuard runs your customer journeys with a robot visitor and checks steps, tracking hits and lead delivery, but it does not inspect your cache configuration or cache hit rates. The kind of tool that fits is a page speed or performance monitoring tool, together with your CDN or hosting cache analytics and the curl check above. FunnelGuard can still help with the wider funnel, for example confirming the form and tracking work after a caching change.

There is a free plan (1 site, 2 journeys, daily checks, no card), and a free read-only website audit.

Questions people ask

Why is my landing page not cached when the URL has UTM parameters?

Your cache probably uses the full URL, including the query string, as its key. A URL with new UTM or click ID values looks like a new page, so it is a miss or is skipped entirely. Tell the cache to ignore tracking parameters.

Does ignoring UTM parameters in the cache break my tracking?

No. Analytics scripts read the parameters in the browser from the URL, not from the cached HTML. As long as the URL keeps its parameters, GA4 and ad tags still see them.

How do I make Cloudflare ignore gclid and fbclid for caching?

Use a cache rule or cache key setting that ignores or excludes specific query parameters. Exact options depend on your Cloudflare plan and dashboard version, so check their documentation for custom cache keys.

How can I tell if my page cache varies on query string?

Request the plain URL and a tagged URL twice each with curl -I. If the plain one shows a cache HIT and the tagged one shows MISS or BYPASS, even after repeating it, the query string is part of the key.

Which parameters are safe to ignore in the cache key?

Tracking parameters such as utm_source, utm_medium, utm_campaign, utm_term, utm_content, gclid, fbclid, msclkid and ttclid. Do not ignore parameters that change the content, like search terms, filters or language.

Does FunnelGuard detect cache misses on query strings?

No. This is outside what FunnelGuard checks. A page speed monitoring tool or your CDN's cache analytics is the right fit.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

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.