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_idin the template context - Meta tags, OG tags, and structured data remain unaffected for staff users
- When a logged-in staff user (
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