DNI: caching and CDN issues (Cloudflare, WordPress caching, server cache)
The Nimbata DNI script must execute fresh on every page visit.
It needs to read the current visitor's session and source in real time to decide which number to show.
If your site is serving a cached copy of the page or script, the swap may fail silently or behave inconsistently between visitors.
Why caching causes swap failures
Caching works by storing a copy of your page (or its assets) and serving that copy to subsequent visitors instead of generating a fresh response.
This is great for performance but problematic for DNI when:
- The page HTML is cached with the original static number baked in, and Nimbata never gets a chance to replace it.
- The Nimbata script itself is cached and served with a stale version that doesn't reflect your latest swap group or tracking code configuration.
- Query string parameters (like
?gclid=test) are stripped or ignored by the cache, so Nimbata never receives the signal needed to identify the visit source.
Cloudflare
Cloudflare's caching can strip query strings, cache page HTML, and delay script updates from reaching visitors.
Check and fix:
- In your Cloudflare dashboard, go to Caching > Configuration.
- Make sure Query String handling is set to preserve all parameters, not to ignore or strip them.
- A setting that strips query strings will prevent
gclidand UTM parameters from reaching your page.
If Cloudflare is caching your page HTML:
- Create a Cache Rule to bypass caching for pages containing your tracking numbers.
If you recently updated your Nimbata script:
- Go to Caching > Purge cache
- Purge the affected URLs so visitors receive the updated version.
- Check whether Rocket Loader is enabled under Speed > Optimization.
- Rocket Loader defers JavaScript execution and can cause the DNI script to fire after the page has already rendered.
- This results in a visible number flash or missed swap.
- Disable it for the Nimbata script or for the site if DNI swaps are unreliable.
WordPress caching plugins
WordPress caching plugins (WP Super Cache, W3 Total Cache, WP Rocket, LiteSpeed Cache, etc.) generate static HTML copies of your pages.
If the static copy contains your regular number, Nimbata will never see the original page load and the swap won't fire.
Check and fix:
- Open your caching plugin's settings.
- Find the excluded pages or cache exclusion list.
- Add any pages that contain your tracking numbers to the exclusion list.
- Alternatively, look for a setting to exclude scripts from deferral.
- Add the Nimbata script URL so it is not deferred or async-loaded in a way that delays execution.
In WP Rocket specifically:
- Go to File Optimization.
- Add the Nimbata script to the Excluded JavaScript Files list.
- This will prevent it from being minified, combined, or deferred.
- After making changes, clear your plugin's cache and test in an incognito window.
Server-level and hosting cache
Some hosting providers (SiteGround, Kinsta, WP Engine, and others) apply server-side caching independently of any plugin.
This cache sits below WordPress and is not controlled by caching plugins.
Check and fix:
- Log into your hosting control panel.
- Look for a caching section (often called "Dynamic Cache", "Full Page Cache", or similar).
- Flush the server cache after any changes to your Nimbata script or swap group configuration.
- If your host supports cache exclusion rules, exclude pages containing your tracking numbers from full-page caching.
- Contact your hosting support if you cannot locate the cache controls.
- Most managed WordPress hosts can add exclusion rules for specific pages or query strings on request.
General test to confirm a caching issue
- Open your page in an incognito window.
- Append
?gclid=test&nocache=1to the URL. - The second parameter forces a unique URL that most caches won't have stored.
- If the number swaps with this URL but not without it, a cache is serving a stored version of the page without the query string.
- Compare the page source (Ctrl+U) of the cached version vs. a forced-fresh version to see whether the static number is baked into the HTML.
Troubleshooting: DNI: troubleshooting checklist (numbers not swapping)
Detailed guide: DNI script 101: how to install and configure it
Detailed guide: How to activate the DNI script via Google Tag Manager
Updated on: 03/04/2026
Thank you!