Skip to content

Wire GA4 acquisition-only analytics behind the existing consent preference center #225

Description

@alexeygrigorev

Parent decision: #27
Normative decision: Open decision 16

Scope

The analytics-consent preference center already exists (`core/static/core/analytics_preferences.js`, the `dtc_analytics_consent` cookie handled in `core/middleware.py`, and the footer "Analytics preferences" control from #125), but no actual GA4 tag is wired up yet.

  • Add GA4 (`gtag.js`) loaded only after analytics consent is granted through the existing preference center — never before consent, never on denial.
  • Configure GA4 for acquisition-only signal: pageviews, sessions, and referrer/UTM acquisition source. Explicitly disable "enhanced measurement" (scroll depth, outbound clicks, site search, video engagement, file downloads) — that crosses into behavioral analytics, which is out of scope per the owner decision in Decision: Approve analytics and tracking preservation policy #27.
  • Development and preview environments must never send analytics hits to the production GA4 property (matches the existing "development/previews do not send production analytics" requirement).
  • Measurement ID should be environment-configured, not hardcoded, so dev/preview can point at nothing or a separate non-production property.

Non-goals

Does not add event tracking, conversion goals, enhanced measurement, or any new tracking pixel beyond the single GA4 acquisition tag. Does not reopen the "no new behavioral analytics in MVP" decision.

Acceptance criteria

  • GA4 tag loads only post-consent, confirmed via network inspection with consent granted/denied/unset.
  • Enhanced measurement is off; only pageview/session/acquisition data is collected.
  • Dev/preview traffic never reaches the production GA4 property.
  • Measurement ID is environment-configured.

Dependencies

Depends on #27 (decision, resolved) and the existing consent infrastructure from #125.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions