Integrations
WordPressWordPress
field-testedPlatforms and stores

Cookie banner for WordPress with Consent Mode v2 and tracker blocking

Add CookiePilot to WordPress without editing the theme. The plugin handles the cookie banner, Consent Mode v2, domain key and basic tracker checks on the public site.

Consent behaviour

Configuration from the WordPress admin.

Domain key and banner settings are synced.

Safe default consent values for Google Consent Mode.

Setup steps

Install the CookiePilot plugin from the official WordPress.org directory and activate it.

Log in or register in the plugin panel and click Add this domain. The domain key is stored automatically.

Enable Consent Mode v2 and save the configuration.

Open the frontend in a clean session and verify the banner before consent.

Example snippet

Example snippet
<?php
add_action('wp_footer', function () {
    ?>
    <script>
    window.addEventListener('cookiepilot:consent', function (event) {
      var consent = event.detail || {};
      if (!consent.marketing) return;

      var script = document.createElement('script');
      script.src = 'https://example.com/marketing-tag.js';
      script.async = true;
      document.head.appendChild(script);
    });
    </script>
    <?php
}, 30);

window.CookiePilot
CookiePilot.getConsent && CookiePilot.getConsent()
document.cookie.split('; ').filter(function (cookie) {
  return /(_ga|_fbp|_gcl|_hj|_ttp)/.test(cookie);
})

Test checklist

window.CookiePilot is available on the frontend.

Before consent there are no _ga, _fbp, _gcl or similar cookies.

Reject keeps the site functional.

Accept sends the consent update to dataLayer.

Related integrations

See the setups that most often appear together with this integration.

Ready to configure it?

Start CookiePilot, choose the right integration and verify that tags wait for user consent before they run.