WordPress & performance plugins
WP Rocket, LiteSpeed, Autoptimize, Perfmatters, SiteGround Optimizer and Cloudflare can re-host or delay the Optimeleon script. The exclusion rules that keep it intact.
Who this is for: anyone installing Optimeleon on WordPress, or on any site behind a caching, speed or CDN optimisation layer such as WP Rocket, LiteSpeed Cache, Autoptimize, Perfmatters, SiteGround Optimizer or Cloudflare.
What can go wrong
Performance plugins rewrite the <script> tags on your pages to make them “faster”. Two of those rewrites break Optimeleon, and both fail silently.
- Your site starts serving a copy of Optimeleon's script. Minify/combine features, and CDN “self-host third-party scripts” features, download our script and serve the copy from your own domain. It still loads and looks fine, but your analytics events are then posted to your web server, where they are lost. Your tests keep running, so nothing looks broken; the data just stops arriving. A copied script also freezes your campaign configuration at the moment the copy was made, so a variant you publish later can silently never go live.
- “Delay JavaScript execution” stops our script running. Delay features hold every tag until the visitor's first interaction: a scroll, a tap, a mouse move. Visitors who leave without interacting are never counted, and variants apply late and visibly.
The snippet protects itself, mostly
Optimeleon scans your site to see which speed plugin it runs, and the snippet you copy from the app carries the opt-out attributes that plugin honours. A site running none of these gets a clean snippet with no extra attributes at all.
| Attribute | Added when we detect | What it stops |
|---|---|---|
nowprocket | WP Rocket | Delay JavaScript execution, defer |
data-no-minify="1" | WP Rocket | Minify / combine JavaScript |
data-no-optimize="1" | LiteSpeed Cache | JS optimisation (minify / combine) |
data-no-defer="1" | LiteSpeed Cache | JS defer / delay |
data-noptimize="1" | Autoptimize | Optimisation |
data-cfasync="false" | Cloudflare Rocket Loader | Deferral |
Attributes only protect tags the plugin can see them on, so they cannot rescue a snippet the plugin has already cached a rewritten copy of. Add the exclusions below in that case. And several tools (Perfmatters, SiteGround Optimizer, W3 Total Cache, NitroPack) publish no per-tag attribute at all, so for those the exclusions are the only protection. Add them regardless.
Plugin-by-plugin exclusions
WP Rocket
Two settings, and the order matters.
- First, stop WP Rocket serving a copy. Settings → WP Rocket → File Optimization → Minify JavaScript files → Excluded JavaScript Files:
edge\.optimeleon\.com - Purge the caches. WP Rocket → Clear cache, and also Remove all minified CSS and JS files. Reload your page and confirm the source loads the script from
https://edge.optimeleon.com/…. If the URL still containswp-content/cache/min, the exclusion did not take. - Then stop WP Rocket delaying it. File Optimization → Delay JavaScript execution → Excluded JavaScript Files, add both lines:
optimeleon __opti
your-site.com/wp-content/cache/min/…) and contains no “optimeleon” for the delay exclusion to match. Exclude minify first, purge, and only then does the delay exclusion see a URL it can match. (__opti covers the inline part of the snippet either way.)LiteSpeed Cache
LiteSpeed Cache → Page Optimization → Tuning:
- JS Excludes, add
edge.optimeleon.com - JS Deferred / Delayed Excludes, add both
edge.optimeleon.comand__opti
Then purge all caches (LiteSpeed Cache → Toolbox → Purge All).
Autoptimize
Settings → Autoptimize → JS, CSS & HTML → Exclude scripts from Autoptimize, add edge.optimeleon.com. Then Delete Cache.
Perfmatters
Perfmatters → Assets → JavaScript → Delay Behavior → Excluded from Delay, add both optimeleon and __opti. If script minification or combining is enabled, exclude edge.optimeleon.com there too.
SiteGround Optimizer
SG Optimizer (Speed Optimizer) → Frontend Optimization → JavaScript → Exclude from Minification / Combination / Defer, add edge.optimeleon.com. Then purge the dynamic cache.
Cloudflare and similar CDNs
- Rocket Loader. Our tags already carry
data-cfasync="false", which Rocket Loader honours. No action needed unless the attribute was stripped. - “Self-host third-party scripts” features. Exclude
edge.optimeleon.comso our script is always loaded from us, never from a copy.
Verify it worked
- Open your page source and confirm both Optimeleon script tags load from
https://edge.optimeleon.com/…, not from your own domain. - Confirm the tags are plain
<script async src="…">, nottype="text/rocketlazyloadscript"ordata-rocket-src="…". - Load the site, accept your cookie banner, and check DevTools → Network for a
POST https://edge.optimeleon.com/e/…returning 202.
