Jump to content

Recommended Posts

Posted

Hi everyone,

I'd like to share Cookie, a consent management module I've been building — a consent banner, preferences window, server-side auto-blocking of trackers, and an interactive visual builder for styling the whole thing without touching CSS.

fGCAr.gif.c8fcdf816660d8a2a2fd58e6cb50606f.gif

Why

Most consent solutions I looked at made you choose: either you get compliance (trackers actually blocked before consent) or you get design control (colors, layout, icon placement) — rarely both without editing CSS/JS by hand. Cookie tries to give you both.

What it does

  • Consent-first by default. Known trackers and embeds (GTM, Google Analytics, Yandex Metrika, Meta Pixel, Hotjar, Clarity, DoubleClick, TikTok, YouTube, Vimeo, Google Maps and more) are neutralized server-side, in the rendered page, before it reaches the browser.
  • Two consent models: opt-in (GDPR/ePrivacy, UK GDPR/PECR, LGPD, Law 25, POPIA, KVKK) and opt-out (CCPA/CPRA and other US state laws), plus Global Privacy Control support, and a geo mode that picks the model automatically by visitor country.
  • Category-based blocking of scripts, iframes, images and video, with placeholders and multi-category requirements.
  • A visual builder (Setup > Cookie — "Design Studio"): live-preview layout, colors, fonts, radius, shadows, spacing. 50 color presets, 25 icon-color presets, 18 dark-theme presets.
  • A floating settings icon with 7 built-in choices, adjustable shape/size/position/color/shadow, including a transparent icon-only mode.
  • A dark theme with its own live-edited color set.
  • A services catalog + cookie policy generator.
  • Google Consent Mode v2, consent expiry/versioning, JS API, CustomEvents.
  • Optional consent log with CSV export and a small statistics dashboard.
  • Everything is hookable, and it's multi-language out of the box with per-language text targeting.

Basic usage

<script type="text/plain" data-consent="statistics" src="https://example.com/analytics.js"></script>
$wire->addHookAfter('Cookie::allowCategory', function($e) {
    if ($e->arguments(0) === 'marketing') $e->return = false;
});

Installation

Copy to /site/modules/, install, configure texts/categories in module settings, design the widget in Setup > Cookie.

Requires ProcessWire 3.0.244+ and PHP 8.2+. MPL-2.0 licensed.

Full docs and hooks reference: README. This is the 1.0.0 release — feedback and bug reports welcome!


  • Like 3
Posted

Hey Maximus. I was literally wondering / hoping last week that someone might build something robust and modern for PW. Most of my clients pay a monthly subscription for third party solutions but they believe rightfully that the EU compliance is non negotiable. So looking forward to trying this on my personal site as a test.

One of the most valuable parts for them is integration with GTM and the reporting dashboard too BTW.

Also that video really helps demo the functionality 👍🏻

  • Like 2
Posted

Hey Peter, thanks a lot — good timing then!

On both points you flagged:

GTM — Cookie ships with Google Consent Mode v2 built in (toggle it on under Integrations). It fires the denied-by-default signals before your GTM/gtag snippet loads, then updates them live on every consent change — so GTM just sees the standard Consent Mode API and behaves correctly without any custom wiring on your end. Only gotcha: keep your GTM snippet loading after the module's own output so the default signals are already in place when it initializes.

Reporting — there's a Consent log (Setup > Cookie > Consent log) with CSV export — timestamp, consent version, granted categories, salted IP hash, configurable retention with auto-purge. On top of that there's a small stats dashboard (accept-all vs. only-necessary vs. custom %, per-category acceptance, a 30-day volume chart) if you just want the at-a-glance numbers without digging into raw export data.

Honestly, the Design Studio is the part I'm most proud of. I don't particularly enjoy digging into code just to customize something visually, so I built the whole widget to be styled entirely from that live-preview builder — colors, fonts, layout, icon, dark theme, all of it — no CSS overrides needed. For agency work with multiple client sites that each need slightly different branding, that's probably the bit that saves the most time.

(And yes, one of the 7 icon choices is a banana that wiggles when you hover it. No compliance value whatsoever, purely for fun — but I couldn't resist leaving it in. 🍌)

Would genuinely love to hear how it goes on your test site — especially if you run it against a client's actual GTM setup, since that's the scenario it matters most for.

Feel free to open an issue on GitHub if anything doesn't line up with how your clients have things wired.

  • Like 1
Posted

I recently extended PrivacyWire (via hooks) to handle opt-in and opt-out models and during my research the one key thing I discovered is that the province of Quebec also requires the opt-in model, so I also use Maxmind's region_code to allow support for specifying which model is used at the region, and not just country level. I also added support for showing a "Opt out request honored via privacy signal" temporary toast message when the browser has set a Global Privacy Control (GPC) policy, rather than either of the opt-in or opt-out banners.

@maximus - does the module support these options?

 

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...