Skip links
View Categories

Cache plugin compatibility guide

1 min read

Opti-Behavior is built to work with page-cache and JavaScript-optimizer plugins with zero configuration in almost every case. A central compatibility layer automatically registers the correct exclusions so your tracking script keeps loading and your A/B tests stay accurate. This article explains what happens automatically and the rare cases where a manual exclusion helps.

How automatic compatibility works #

On every request, Opti-Behavior hooks into the documented filters of the major optimizers and tells them to leave its tracking script and inline configuration alone. It also tags its scripts with the standard “do not optimize” attributes that most cache plugins respect.

Optimizers handled automatically #

Plugin What is excluded automatically Manual config needed?
WP Rocket JS combine, JS defer, delayed inline JS, plus an A/B cache-vary cookie No
LiteSpeed Cache JS combine, JS defer, and the A/B vary cookie No
W3 Total Cache JS minification of the tracking tag No
Autoptimize / Breeze JS aggregation (via data-noptimize) No
Perfmatters Delay JS, defer JS and minify JS No
WP Super Cache, Hummingbird, Swift Performance, Speed Booster Pack, SG Optimizer Respected via DONOTCACHEPAGE / no-optimize attributes No

Why A/B tests need a cache-vary cookie #

When a visitor is assigned an A/B variant, a page cached for one variant must never be served to a visitor in another. Opti-Behavior sets a fixed-name companion cookie, opti_ab_v, and automatically registers it with WP Rocket and LiteSpeed so each variant gets its own cached copy. You do not configure this. See A/B testing troubleshooting if variants are not showing.

When you might add a manual exclusion #

If you use an optimizer that is not listed above and it aggressively combines or delays JavaScript, add an exclusion so the tracking script runs.

  1. Open your optimizer’s JavaScript exclusion / “exclude from delay” setting.
  2. Add a rule matching the string opti-behavior (this covers both the script filename and inline config).
  3. Clear the cache and reload a front-end page.
opti-behavior
optibehavior

Expected result #

After clearing your cache, a front-end page still loads the Opti-Behavior tracking script and new sessions appear on the dashboard. A/B variants render correctly for different visitors even with full-page caching enabled.

Troubleshooting #

  • No new sessions after enabling caching: confirm the page is not served as a static HTML file that strips the script; add the opti-behavior exclusion above.
  • Same A/B variant for everyone: your cache is not varying on opti_ab_v; purge the cache and confirm the cookie is not stripped by a CDN.
  • Stale numbers: object-cache or CDN edge caching can delay dashboard updates; purge and wait for the next aggregation cycle.

FAQ #

Do I need to exclude anything by default? #

No. For the optimizers listed above, no configuration is required.

Does a CDN break tracking? #

No, as long as the CDN forwards the opti_ab_v cookie for pages running A/B tests.

Related articles #

Leave a comment

Explore
Drag