Documentation
WordPress
The Splitlab plugin adds the Splitlab engine to every page of your WordPress site. You don't need to edit your theme. If you run WooCommerce, the same plugin can also report orders as test revenue.
| Requires | WordPress 5.7 or later, PHP 7.4 or later |
| WooCommerce | Optional. Classic and block checkout, and High-Performance Order Storage (HPOS), are supported |
| Plugin slug | splitlab |
Install
- In your WordPress admin, go to Plugins → Add New and search for Splitlab. Click Install Now, then Activate.
- Go to Settings → Splitlab.
- Paste your project key and click Save Changes. The project key is the
data-project-keyvalue in the dashboard under Install / SmartCode, on the Wordpress tab. - Verify the install.
Plugin not in search yet?
The plugin is in review for the WordPress.org directory. Until it is listed, ask Splitlab support
for splitlab.zip and upload it under Plugins → Add New → Upload Plugin. Updates then
arrive through Plugins like any other plugin once the listing is live.
Nothing is printed on your pages until a project key is saved.
Settings
All settings are under Settings → Splitlab.
| Setting | Default | What it does |
|---|---|---|
| Project key | empty | Required. Which Splitlab project the site belongs to. Only letters, digits, _ and - are kept. |
| Anti-flicker | On | Hides the page until the engine has applied the visitor's variant, so they never see the original first. |
| Reveal anyway after | 3000 ms | If the engine has not loaded by then, the page is shown anyway. Accepts 500 to 10000 ms. |
| Server API key | empty | Only needed for WooCommerce revenue. |
| Environment | Production | Leave on Production. Staging points at Splitlab's internal test servers. |
What the plugin adds to your pages
The plugin prints two scripts as the first thing in <head>, ahead of your theme's styles
and scripts:
- The anti-flicker script (when it is on). It sets
body { opacity: 0 }and reveals the page when the engine callswindow.rmfk(), or after the timeout. - The engine, loaded
asyncfromhttps://cdn.splitlab.io/cdn/engine.js, with your project key indata-project-key.
This is the same code as the install snippet, so everything on that page about consent, options and verifying applies here too.
Caching and optimisation plugins
Plugins that defer, delay or combine JavaScript break this setup in one of two ways:
- If the anti-flicker script is delayed, visitors briefly see the original page before the variant appears.
- If the engine is delayed until the visitor interacts, the page stays blank until the anti-flicker timeout.
The plugin marks both scripts so the common optimisers leave them alone:
| Optimiser | How the plugin opts out |
|---|---|
| WP Rocket (Delay JavaScript execution) | nowprocket attribute |
| LiteSpeed Cache | data-no-optimize="1" and data-no-defer="1" |
| Cloudflare Rocket Loader | data-cfasync="false" |
| Autoptimize | Wrapped in <!--noptimize--> … <!--/noptimize--> |
If you use a different optimiser and see flicker or a blank page, exclude mvt-anti-flicker,
mvt-engine-script and cdn.splitlab.io in its JavaScript settings.
Clear the page cache after installing
A full-page cache keeps serving pages built before the plugin was active. Purge it after you save the project key, or the snippet only appears as cached pages expire.
Cookie consent
If your Splitlab project requires cookie consent, the engine stores nothing until the visitor grants it. The plugin adds nothing of its own on top of this. See the install snippet for how consent is signalled to the engine.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Verify finds no snippet | Page cache still serving old pages | Purge the cache, then verify again |
| Verify finds no snippet | Project key not saved | Check Settings → Splitlab |
| Original page flashes before the variant | An optimiser is delaying the anti-flicker script | Exclude it as described above |
| Page stays blank for a few seconds | An optimiser is delaying the engine | Exclude it as described above, or lower Reveal anyway after |
| Snippet appears twice | The snippet was also pasted into a header plugin or the theme | Remove the pasted copy; the plugin is enough |
Uninstall
Deactivating the plugin removes the snippet from your pages. Deleting it under Plugins also deletes its settings. Order notes and order data written for WooCommerce revenue stay on your orders.
Prefer head code?
If you would rather not use a plugin, paste the install snippet into your
theme's <head> or a "header code" plugin instead. Use one method, not both. WooCommerce revenue
needs the plugin.