Using the Delay JavaScript execution option in WP Rocket → File Optimization settings can significantly improve your website performance. Not only does it improve the perceived loading speed, but it can also increase your Lighthouse performance score — and therefore positively impact your Core Web Vitals (which ultimately affect your SEO).
However, this feature may conflict with the WebToffee GDPR Cookie Consent plugin (and other cookie consent plugins).
According to GDPR requirements and your cookie settings, the cookie banner must load immediately for legal compliance — not only after user interaction. When JavaScript is delayed, the cookie notice may not appear on time, which can create compliance issues.
Excluding WebToffee GDPR Cookie Consent (Latest Version)
If you are using the latest version of the WebToffee GDPR Cookie Consent plugin, you need to manually exclude its JavaScript files from WP Rocket’s Delay JavaScript execution.
Simply copy and paste the following rule into:
WP Rocket → File Optimization → Excluded JavaScript Files
/wp-content/plugins/webtoffee-cookie-consent/(.*).js
This ensures that all JavaScript files from the plugin are excluded from being delayed.
This ensures that all JavaScript files from the plugin are excluded from being delayed.
⚠️ Important: Please double-check the exact plugin path and folder name. In some cases, when installing a new ZIP file, WordPress may automatically add a suffix like -2, -3, or -4 to the plugin folder name. If that happens, adjust the exclusion path accordingly.
WebToffee GDPR Cookie Consent – Legacy Version
If you are using the older Legacy version of the plugin, excluding it from Delay JavaScript execution is easier.
WP Rocket can handle this automatically via the One-click exclusions option under the WordPress plugins section.