pypi wagtail-herald 0.8.0
v0.8.0: Staff User GTM Exclusion

latest releases: 0.12.1, 0.12.0, 0.11.1...
7 months ago

What's Changed

New Features

  • Staff users are now excluded from GTM tracking (#117, #118)
    • When a logged-in staff user (is_staff=True) browses the frontend or uses the Wagtail preview panel, the GTM snippet is automatically omitted from the HTML output
    • This prevents internal traffic from polluting analytics data (GA4, Clarity, etc.)
    • No template changes required — works by suppressing gtm_container_id in the template context
    • Meta tags, OG tags, and structured data remain unaffected for staff users

How It Works

A new internal helper _should_exclude_gtm() checks request.user.is_staff. When True, both seo_head and seo_body template tags set gtm_container_id to an empty string, which the existing {% if gtm_container_id %} guard in templates respects.

Migration

No migration or configuration changes required. After upgrading, staff users will automatically be excluded from GTM tracking.

Full Changelog: v0.7.0...v0.8.0

Don't miss a new wagtail-herald release

NewReleases is sending notifications on new releases.