[00] Subset Opt-Out, User guide
Cloudflare Rocket Loader
Last updated
How Subset Opt-Out keeps Cloudflare Rocket Loader away from its scripts, what to check after turning Rocket Loader on, and the limits.
Subset Opt-Out works on sites that use Cloudflare’s Rocket Loader, with no setup in Cloudflare. Rocket Loader runs at Cloudflare’s edge, not in WordPress, so Subset Opt-Out marks its own scripts with the attribute Rocket Loader reads as an instruction to skip them.
What works
Subset Opt-Out relies on two inline scripts in <head> and one script file. They have to run unchanged, in order, before any tracker. Rocket Loader would otherwise load them later, together with the rest of the page’s JavaScript.
Each of the three tags carries data-cfasync="false", which tells Rocket Loader to ignore the script. Rocket Loader reads it only when it comes before src, so Subset Opt-Out prints it first (Cloudflare on ignoring scripts (opens in a new tab)). The attribute is the same for every visitor, so Cloudflare can cache the page.
Held trackers are printed as type="text/plain", which the browser doesn’t run. Subset Opt-Out turns them back into scripts, in order, once the visitor’s choice allows them.
What needs a setting
Nothing. Rocket Loader is switched on or off under Speed → Settings → Content Optimization → Rocket Loader in the Cloudflare dashboard (Cloudflare’s setup guide (opens in a new tab)). After you change it, purge Cloudflare’s cache if it caches your HTML. Then test a page as an opted-out visitor, or with Global Privacy Control turned on in your browser. Global Privacy Control shows how to check what’s held.
Known limits
- Only Subset Opt-Out’s own scripts are marked. Rocket Loader handles every other script as usual, including trackers once Subset Opt-Out releases them.
- Versions before 0.5.3 put the attribute after
srcon the script file. Rocket Loader can defer that file, so update Subset Opt-Out if you use Rocket Loader. - Scripts above
wp_headrun first. A tracker printed beforewp_head(), or moved above it, runs before Subset Opt-Out can hold it.