Skip to content

Load Google Analytics only after consent #83

Closed

Description

Priority: high (privacy; the site sells to schools).

src/components/Analytics.astro loads gtag on every page with Consent Mode v2 set to denied. Its own comment says that with consent denied, GA "still loads and still sends Google a cookieless ping". So "no cookies until you agree" is true, but "no contact with Google until you agree" isn't. A school's data-protection lead will ask about exactly that.

Fix

  • Don't load the GA loader at all until analytics consent is granted. CookieBanner.astro injects it when the visitor agrees, or on load when a stored consent says yes.
  • Check the stored consent's version (CONSENT_KEY, and the v it carries) in both Analytics.astro and SupportWidget.astro. Consent from an older banner version must count as not given.
  • Privacy policy (src/data/legal.ts): it can then say Google is contacted only after you agree. Keep it word-for-word true.
  • Tests (tests/security.test.ts): no googletagmanager request before consent; one after; none for an old consent version.
  • Probe: run the existing consent probe (npm run consent:probe).

Activity

  1. added a commit that references this issue on Oct 13, 2026
    1945708
  2. bryanfawcett commented on Oct 13, 2026

    @bryanfawcett
    MemberAuthor

    Fixed on staging by #87. It reaches production with the next staging → main release.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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