Skip to content
Limitless Horizons Development, LLC
Menu

Announcing two open source Wagtail apps

Wagtail apps for managing your Google tag and visitor cookie consent

Rod Gammon · · 3 min read

Share

I’ve released two open-source packages for Wagtail (a content management system built on Django). One allows Google tag configuration from the admin UI; the other lets visitors manage cookie consent.

This site uses Wagtail and both packages run here. I believe in user-centric software, which includes consent-driven analytics: visitors decide whether to share data. These packages enable that with professional-quality consent handling and an administrative experience that feels native to Wagtail.

Why these were created

When an analytics tag and a cookie banner are written into a site’s templates, small decisions become development work: banner text, notice updates, whether staff visits are in or out of the numbers... Those are content and policy choices, not engineering ones, and they shouldn’t burn developer time and delay delivering decisions.

With these packages, a developer installs each one and adds small tags to the site’s page templates. After that, groups with the proper permissions can configure behavior using the Wagtail admin. Who can change these settings is still controlled, now by Wagtail’s permissions instead of access to the code.

wagtail-cookie-consent

This package lets visitors manage their consent to cookies. It isn’t specific to Google Analytics: use it on any Wagtail site that asks visitors before setting optional cookies.

  • In the admin: who sees the banner, which categories it asks about, what it says, and which page serves the privacy notice.
  • For visitors: accepting and refusing are equally easy, every category starts switched off (opt-in by default), and a Cookie settings link lets them change or withdraw their choice later.
  • Privacy: the banner’s scripts and styles ship inside the package, so nothing loads from a third party. The choice is kept for 182 days in a cookie on the visitor’s own device.
  • Limits: it doesn’t block other scripts or delete their cookies; the code on the page has to act on each visitor’s choice.

wagtail-google-tag

This package manages when and how a site sends data to Google Analytics 4 through the Google tag.

  • In the admin: the measurement ID, whether European visitors start with analytics denied, and which signed-in users are left out of tracking.
  • Consent: by default, visitors in the European Economic Area, the UK, and Switzerland start with analytics denied, and visitors elsewhere start with it granted. The tag updates when it’s told a visitor’s choice. If analytics is refused or withdrawn, it sets no analytics cookies, sends Google only cookieless pings, and deletes the Google Analytics cookies already on the device.
  • Personal data: clicks on email and phone links are recorded by link type only, never the address or number.
  • Limits: it doesn’t bring Google Analytics reports into the Wagtail admin or load a Tag Manager container of your own.

Used together

The packages are independent but can collaborate. When both are installed, the banner announces each visitor’s choice to the page and the tag updates Google’s Consent Mode to match. The tag will take the same message from any banner, and the banner’s announcement is there for any script that needs it.

To Do Next

Both packages are early releases. They are open source under the BSD license. They can be found on PyPI:

Give them a try, and let me know if they helped. Contributions to either project are welcome.