Home / Docs / Cache plugins

Cache plugins and CDNs

Cookie banner cache plugin conflicts do not happen with ClearCrumb in normal use: it is built to work with full-page caching, so there is usually nothing to do. Every visitor gets the same cached HTML, and the banner decides in the browser what to show and what to release. This page explains why, which optimisers ClearCrumb sets up for you, and the few checks worth doing.

Why is full-page caching safe with ClearCrumb?

Full-page caching stores one copy of each page and serves it to everyone. That is the classic cookie banner cache plugin worry, because each visitor makes a different choice. ClearCrumb avoids the problem by keeping the HTML identical for everyone and doing the personal part in the visitor’s browser.

  • Every visitor gets the same HTML. The banner is drawn in the browser from the saved choice in the first-party clearcrumb_consent cookie, so a cached page never contains another visitor’s answer.
  • The visitor’s region comes from a small request that is never cached. With region rules on, the browser asks the REST route clearcrumb/v1/region, which answers with Cache-Control: no-store, private, max-age=0. It returns only the region and the two-letter country code, never the IP address.
  • The guard script is printed inline in the head (about 3 KB), so it is never delayed, combined or fetched as a separate file.
  • The banner stylesheet prints in the footer, so ClearCrumb adds nothing render-blocking to the head. The banner itself is under 10 KB.

If the region request does not answer within 2.5 seconds, the browser’s time zone decides, so visitors are never kept waiting by a slow server. The no-store directive is explained in MDN’s Cache-Control reference: it tells browsers, CDNs and page caches not to keep a copy. So with ClearCrumb, the right cookie banner cache plugin setup is usually the one you already have.

Cookie banner cache plugin flow: the cached page is served, the inline guard runs, the region is checked, then held tags are released after consent

Which cookie banner cache plugin settings are automatic?

ClearCrumb tells the popular optimisers to leave its files alone: no delay, no combine, no defer. You do not need to paste exclusion lists into them by hand. This is what ClearCrumb sets up for each cookie banner cache plugin pairing:

Plugin What ClearCrumb sets up
WP Rocket Its files are excluded from minify and combine, defer and “Delay JavaScript”. ClearCrumb also blocks tags before WP Rocket optimises the page, so held tags are skipped.
LiteSpeed Cache Its scripts are excluded from JavaScript optimisation and defer.
SiteGround Optimizer Its scripts are excluded from combine, minify and async loading.
Autoptimize Its files are added to the JavaScript exclusion list.
W3 Total Cache, FlyingPress and others They read the standard opt-out attributes on ClearCrumb’s script tags.
Cloudflare Rocket Loader data-cfasync="false" keeps it from rewriting the tags.

Every ClearCrumb script tag, including the inline configuration, carries data-cfasync="false" for Cloudflare Rocket Loader and data-no-optimize, data-no-defer, data-no-minify and nowprocket for other optimisers. If you added ClearCrumb’s files to an exclusion list yourself in the past, you can leave them there.

What happens to blocked scripts on a cached page?

ClearCrumb blocks scripts, iframes and tracking stylesheets on the server for 155 known services, before the page reaches your cache. The cached copy therefore already holds those tags in a waiting state: a blocked script gets type="text/plain" and a mark for the category it needs. Nothing in it runs until the guard sees consent.

Held tags carry the same opt-out attributes as ClearCrumb’s own scripts, so an optimiser does not pick them up and move them around. When a visitor accepts a category, the guard releases the matching tags straight away, in page order, without a reload.

When a visitor later takes a “yes” back, the page reloads so the scripts that already ran are blocked again. Both steps happen in the browser, so the cached HTML never has to change per visitor. Read Block scripts until consent for how the blocking works in detail.

When should I clear the page cache?

Clear your page cache after adding or removing services, so cached pages get the new blocking. The blocking rules and the banner settings are written into each page’s HTML when it is built, so an old cached copy keeps your old setup until it expires or is purged. ClearCrumb does not purge other plugins’ caches for you, so this is the one cookie banner cache plugin step you always do yourself.

Purge the cache at these moments:

  • after the first setup, so every page gets the banner and the guard;
  • after you add or remove services on the Services & cookies screen, or add services the scanner found;
  • after you change the banner text, design or region rules on the Banner screen;
  • after you switch the banner off or on with Show the banner on my site.

If a CDN such as Cloudflare caches your HTML as well, purge it too. A visitor who still sees the old banner usually has a stale cached page, not a ClearCrumb fault.

Cookie banner cache plugin checklist: what ClearCrumb configures automatically and what you still do after changes

What about Delay JavaScript features?

Some optimisers delay all scripts until the visitor moves the mouse, scrolls or taps. If the ClearCrumb guard were delayed as well, other scripts could run before it and tracking would start before consent. Delaying the banner script would also hide the banner until the first scroll.

For WP Rocket, LiteSpeed Cache, SiteGround Optimizer and Autoptimize the exclusion is automatic. If another optimiser delays all scripts until user interaction, check that the ClearCrumb guard is excluded. Add these three patterns to its exclusion list if they are not covered:

  • /clearcrumb/assets/js/ (ClearCrumb’s script files);
  • clearcrumbGuard (the inline guard settings);
  • clearcrumbConfig (the inline banner settings).

Run the Leak Test after any optimiser change. Delay features cause the most common cookie banner cache plugin problem: a tag fires early on a site that otherwise looks fine.

How do I test my cookie banner cache plugin setup?

A quick test takes a few minutes and proves the cache and the banner work together:

  1. Clear your page cache (and CDN cache, if you use one).
  2. Open your site in a private window. The banner should show, and the page should load as fast as before.
  3. Go to ClearCrumb → Scanner and click Run Leak Test. It loads up to 15 pages twice, first as a brand-new EU visitor and then as one who accepted everything, and lists anything that loads before consent.
  4. Accept in the private window and check that videos, maps and analytics start; then reopen the settings, reject, and check they stop after the reload.

The cookie leak test guide explains each Leak Test result, and the FAQ covers other common fixes. Repeat this test whenever you change your cookie banner cache plugin settings, add an optimiser or switch hosts.

Cookie banner cache plugin: questions

Do I need to exclude ClearCrumb from my cache plugin by hand?

No special cookie banner cache plugin setup is needed for WP Rocket, LiteSpeed Cache, SiteGround Optimizer or Autoptimize; ClearCrumb adds its exclusions to them itself. For other optimisers the opt-out attributes usually cover it. Only an optimiser that delays every script needs a manual check.

Can a cached page show one visitor’s choice to another?

No. The cached HTML is the same for everyone and holds no choice. Each browser reads its own clearcrumb_consent cookie, and the region request is never cached.

Does ClearCrumb work behind Cloudflare?

Yes. Its tags carry data-cfasync="false" for Rocket Loader, and the visitor’s country is read from Cloudflare’s country header, so region rules work by default. See Geo rules.

Why does a video or map stay blank after consent?

Usually a stale cached page or an optimiser that delays scripts. Clear your page cache, reload, and if an optimiser delays scripts, exclude ClearCrumb as shown above.