Insights

How to Exclude WebToffee GDPR Cookie Consent from WP Rocket Delay JavaScript Execution

Table of Contents

Fix WP Rocket Delay JavaScript conflicts with WebToffee GDPR Cookie Consent and ensure your cookie banner loads instantly and legally.

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.

Picture of Roman Vlčák

Roman Vlčák

An incorrigible perfectionist passionate about pixel-perfect work, who constantly strives to deliver the highest possible quality. Outside of Webgate, he is a caring husband and father to his young son. In his free time, he likes traveling with his family and doing puzzles.

Senior WordPress Developer • Co-founder

Share this artcle

Let's work together!

Get a free consultation with our experts

Subscribe to our quarterly newsletter and receive latest insights.

Topics: Improving B2B websites, AI tools in web development, UX/UI, website marketing trends etc.

By submitting this form you agree to the processing of your personal data according to our .

Contact

Let's work together!

Get a free consulting call with our experts

Book a call with
Webgate founders

Thank you for your interest!

We will contact you soon.