Search for articles…
The original page flashes before the variant
If visitors briefly see your original page before the variant appears, something is stopping the anti-flicker script from running first. Almost always that’s a speed, caching or optimisation plugin that delays, defers or combines JavaScript.
1. How anti-flicker is meant to work
The Splitlab snippet has two parts that must both load early:
The anti-flicker script hides the page (it sets the body’s opacity to 0) the instant the page starts loading.
The engine (engine.js from cdn.splitlab.io) applies the visitor’s variant and then reveals the page straight away.
A failsafe timeout reveals the page anyway if the engine can’t load, so visitors are never stuck on a blank screen. If the anti-flicker script itself is delayed, though, the original page is already on screen before anything hides it — and that’s the flash you’re seeing.
2. Check the snippet is in the <head>
The snippet must sit inside the <head> of every page you test, as high up as you can put it. If it has been pasted into the body, a footer area or a “scripts at the end of the page” setting, move it to the head.
Also make sure the anti-flicker part is included. In the dashboard, open your project’s Install / SmartCode screen and check that Include anti-flicker script is switched on, then copy the snippet again if you changed it.
3. Exclude Splitlab from your optimiser
In your speed or caching plugin, find the JavaScript settings (usually called something like delay, defer, combine, minify or “load on interaction”) and add exclusions for:
cdn.splitlab.io — where the engine loads from
abhide — a keyword inside the anti-flicker script of the standard snippet
mvt-anti-flicker and mvt-engine-script — the two scripts added by the Splitlab WordPress plugin
If you serve the engine from your own first-party domain, exclude that domain as well. Save the plugin settings when you’re done.
4. On WordPress, use the Splitlab plugin
The Splitlab WordPress plugin prints both scripts as the very first thing in the <head> and already marks them so the common optimisers leave them alone:
WP Rocket (Delay JavaScript execution)
LiteSpeed Cache
Cloudflare Rocket Loader
Autoptimize
If you use a different optimiser, add the exclusions from step 3. See Caching and optimisation plugins for the details.
5. Clear your caches and test again
A full-page cache keeps serving pages built before you made the change. Purge your plugin’s cache, any server or CDN cache, then load the page in a private window. The variant should appear without the original showing first.
6. Still stuck?
Send us the page address and the name of your caching or optimisation plugin. Contact us or email team@splitlab.io.
Related articles
Still stuck?
Email team@splitlab.io or send us a message.
Contact us