How to Exclude Captain Compliance Consent Script from WP Rocket Plugin

Table of Contents

Here’s our integration guide for CaptainCompliance.com’s consent management software complete with step-by-step instructions and tailored for WordPress users using WP Rocket.

How to Make Captain Compliance’s Cookie Consent Banner Work Seamlessly with WP Rocket

Captain Compliance offers a powerful, privacy-first cookie consent management platform that helps your website stay compliant with regulations like GDPR, CCPA, and CPRA.

If you’re also using WP Rocket to improve your site speed, you might run into an issue where the cookie banner doesn’t appear properly or shows up empty. This is because WP Rocket’s optimization features (like file minification and deferred loading) can sometimes interfere with the Captain Compliance script. This isn’t just Captain Compliance but any javascript element such as Elementor or other software that is crucial on your site that WP Rocket has had an issue freezing the website so if you’re using WP Rocket you should not be shocked if there is an issue.

Why This Happens:

WP Rocket caches and modifies JavaScript files to speed up load times. If the Captain Compliance script is altered or deferred incorrectly, the banner may not initialize correctly especially on the first page load.

How to Fix It: Exclude the Captain Compliance Script from WP Rocket Optimization

Follow these simple steps to make sure your cookie banner runs correctly while keeping all the benefits of WP Rocket:

Step-by-Step Instructions (With WP Rocket)

  1. Log in to your WordPress Admin Dashboard
  2. In the left-hand menu, go to:
    SettingsWP Rocket
  3. WP Rocket Step 1 For Cookie Compliance Fix
  4. Click on the “File Optimization” tabFile Optimization for WP Rocket
  5. Scroll down to the JavaScript Files section
  6. Find the field labeled “Excluded JavaScript Files”
  7. Add the following Javascript Code from your Consent Management Playground: Enter cptn.co
  8. Scroll to the bottom and click “Save Changes”
  9. Go to the WP Rocket Dashboard and click “Clear Cache”

WP Rocket Javascript Settings for Cookie Consent

Optional: Test Everything Is Working

  • Open your site in incognito mode (or clear your cookies).
  • You should now see the cookie banner load properly on first visit.
  • You can also test via browser DevTools (Console tab) to ensure no script errors are thrown.

Pro Tips

  • Don’t combine or defer the Captain Compliance script. Doing so can break its initialization timing.
  • If you’re using a plugin for content delivery networks (CDNs), make sure the exclusion carries over there too.
  • Always clear all levels of cache (browser, CDN, WP Rocket) after making changes.

By following these steps, you ensure your site stays fast, compliant, and user-friendly.

Need further help? Contact Captain Compliance Support and we’ll walk you through getting this setup as we love to support clients with any IT related issues for cookie consent banners.

 

Written by: 

Online Privacy Compliance Made Easy

Captain Compliance makes it easy to develop, oversee, and expand your privacy program. Book a demo or start a trial now.