Skip to content

[00] Subset Opt-Out, User guide

WP Rocket

Last updated

Which WP Rocket JavaScript settings Subset Opt-Out keeps away from its scripts, when to clear WP Rocket's cache, and the limits.

Subset Opt-Out works with WP Rocket’s page cache and its JavaScript settings, with no exclusions for you to add. It prints the same HTML for every visitor, so cached pages stay correct, and it tells WP Rocket to leave its own scripts and the trackers it holds alone.

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. It keeps them out of these settings on WP Rocket’s File Optimization tab:

WP Rocket settingWhat Subset Opt-Out does
Delay JavaScript executionAdds its scripts to WP Rocket’s delay exclusions and marks them with nowprocket.
Load JavaScript deferredExcludes its script file and its inline scripts from deferral.
Minify JavaScript filesExcludes its script file and its inline scripts.
Combine JavaScript filesExcludes its own scripts, and the script URLs of every service it holds, so a held tracker isn’t pulled into a combined file that runs for every visitor.

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.

The WP Rocket settings are described in its documentation on delaying JavaScript (opens in a new tab), deferring JavaScript (opens in a new tab) and minifying and combining JavaScript (opens in a new tab).

What needs a setting

Nothing in WP Rocket. Clear its cache after you install Subset Opt-Out, and again after you switch a service on or off or add a custom rule. Pages cached before then were built without those changes. Use Clear cache, or Clear and preload cache when preloading is on, on the Dashboard tab of Settings → WP Rocket or in the admin toolbar (WP Rocket’s guide to clearing the cache (opens in a new tab)).

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

  • A tracker no service matches isn’t held. WP Rocket optimises it like any other script, and it runs for everyone. Add a custom rule under Subset → Opt-Out for it.
  • Scripts above wp_head run first. A tracker printed before wp_head(), or moved above it, runs before Subset Opt-Out can hold it.
  • Your own WP Rocket exclusions stay. Subset Opt-Out adds to the lists and never removes what you’ve entered.