Directory / plugin

Clarke Cookie Consent

v0.1.4 · by Clarke Website Design Ltd

Opt-in cookie consent for UK GDPR and PECR: equal Accept and Reject buttons, consent by category, and scripts blocked until visitors agree.

About this plugin

Clarke Cookie Consent asks visitors for permission before any non-essential cookies are set, as the UK GDPR,
PECR and the ICO’s guidance require.

  • A cookie banner with Accept all and Reject all buttons given equal prominence.
  • A preferences panel where visitors choose by category: Necessary (always on), Analytics and Marketing.
  • Tracking scripts are held back until the visitor accepts their category – nothing runs on page load.
  • A small cookie settings button on every page, so visitors can change or withdraw their choice at any time.
    Withdrawing consent removes the tracking cookies the site set and reloads the page.
  • A Cookie Policy page is created for you when the plugin is activated, ready for you to review.
  • Works with page caching – the choice is read in the visitor’s browser, not on the server.

Blocking your scripts

Paste tracking code (Google Analytics, Meta Pixel and so on) into Settings > Cookie Consent > Scripts, under
the right category. It is added to every page, but only runs once the visitor accepts that category.

Scripts already in your theme can be blocked by changing the script tag to:

<script type="text/plain" data-cd-category="analytics"> ... </script>

using analytics or marketing as the category.

Changing the choice later

As well as the floating button, you can add a button anywhere with the shortcode [cd_cookie_settings],
link a menu item to #cd-cookie-settings, or give any element the class cd-cookie-settings.

For developers

  • window.cdCookieConsent.hasConsent( 'analytics' ), .getConsent() and .showPreferences().
  • Document events cd-cookie-consent:ready and cd-cookie-consent:change (the choice is in event.detail.consent).
  • Filters cd_cookie_consent_categories and cd_cookie_consent_clear_cookies.
  • Colours can be changed with CSS variables such as --cd-cc-accent and --cd-cc-bg.

A Pro add-on adds banner position and colour options, Google Consent Mode v2 and a consent log, and holds back YouTube videos and Google Maps until visitors consent.

Plugin tags