Skip to content

Add GA4 measurement with legal-audit deployment gate - #5

Merged
TueJon merged 5 commits into
mainfrom
feat/privacy-safe-measurement
Jul 24, 2026
Merged

Add GA4 measurement with legal-audit deployment gate#5
TueJon merged 5 commits into
mainfrom
feat/privacy-safe-measurement

Conversation

@TueJon

@TueJon TueJon commented Jul 22, 2026

Copy link
Copy Markdown
Owner

TUE-377 measurement deliverable; companion proof PR: TueJon/webmcpify#4

This draft now implements the selected GA4 setup and supersedes the original first-party logger proposal.

What changed:

  • loads the direct Google tag for GA4 stream G-45GCGY7SQN;
  • records the default page view plus two explicit product-intent events: successful install-command copies and WebMCPify GitHub outbound clicks;
  • preserves the original landing URL long enough for Google Ads/UTM attribution, then removes known tracking parameters from browser history;
  • disables Google Signals and ad-personalization signals in tag configuration and limits the Analytics cookie to a non-rolling 90-day lifetime;
  • updates both English and generated German pages;
  • removes the superseded nginx/logrotate/weekly first-party measurement implementation.

External account setup already completed:

  • GA4 property 546963195 is linked only to Ads client 835-125-6521;
  • Enhanced Measurement, Google Signals, user-provided data collection, granular location/device collection, and Ads personalization are off;
  • install_command_copy is the Primary campaign conversion and github_outbound is Secondary;
  • the Google Ads campaign and every serving component remain explicitly paused with €0 spend.

Merge and deployment gate

If deployed as currently written, the Google tag loads on page startup and may set Analytics cookies before consent. This PR is therefore intentionally DRAFT and must not be merged or deployed until the separate legal/privacy audit is complete.

Before approval:

  • confirm the legal basis, controller/processor wording, international-transfer disclosures, retention disclosure, and withdrawal route;
  • update the privacy notice and cookie/CMP copy in both language variants;
  • implement the approved CMP/Consent Mode design so no GA request or Analytics cookie occurs before the required opt-in;
  • verify refusal and withdrawal stop subsequent collection;
  • verify all four Consent Mode v2 signals and both explicit events without enabling Ads personalization, Google Signals, or Enhanced Measurement;
  • record the audit decision in ANALYTICS.md and this PR.

Verification completed:

  • node --test tests/analytics.test.mjs — 7/7 passing
  • node --check analytics.js
  • python3 build-de.py
  • git diff --check
  • guarded Google Ads API read-check confirms the campaign remains paused and its measurement configuration matches the approved spec

Nothing in this PR has been deployed, and no ad spend has been enabled.

@TueJon
TueJon marked this pull request as draft July 24, 2026 17:54
@TueJon TueJon added enhancement New feature or request documentation Improvements or additions to documentation labels Jul 24, 2026
@TueJon TueJon self-assigned this Jul 24, 2026
@TueJon TueJon changed the title Add privacy-safe first-party launch measurement Add GA4 measurement with legal-audit deployment gate Jul 24, 2026
TueJon added 2 commits July 24, 2026 20:23
Findings and full rationale in docs/LEGAL_COMPLIANCE_PLAN.md (audit 2026-07-24):

- Add privacy.html (bilingual, Art. 13 GDPR: server logs, localStorage,
  self-hosted fonts, data-subject rights, DSB complaint contact) and link
  it from every page footer plus the imprint
- Self-host Familjen Grotesk and Spline Sans Mono (SIL OFL) from /fonts/;
  drop the fonts.googleapis.com / fonts.gstatic.com embeds on all pages
- Persist wmcp-lang only on an explicit language choice (toggle click or
  WebMCP set_language call), not on automatic first-load detection
- Imprint: label the address row as seat & address (§14 UGB)
- Accessibility: announceable copy toast, localized toggle aria-label and
  diagram title in German mode, og/twitter image alt texts
- llms.txt: 'byte-identical' -> 'behaves identically' (accuracy)
Merges fix/legal-compliance (privacy policy, self-hosted fonts) and closes
the legal-audit launch gate from docs/LEGAL_COMPLIANCE_PLAN.md P2.1:

- consent.js is now the only script entry: nothing GA-related runs before
  opt-in — no gtag.js request, no dataLayer command, no cookie (basic
  Consent Mode). analytics.js no longer has import side effects.
- Banner with Allow/Decline as identical .btn buttons on one layer,
  non-modal so imprint and privacy policy stay reachable; footer 'Cookie
  settings' button reopens it. Declining after a grant sets ga-disable,
  pushes a consent-denied update, and expires _ga*/_gcl* cookies.
- Decision stored as wmcp-consent {v, analytics, ts} — timestamped, no
  identifier.
- page_location sent to GA is origin + path + attribution params only;
  arbitrary query data and fragments stay local. cookie_domain pinned,
  Secure;SameSite=Lax, consent defaults pushed as the first command,
  dataLayer entries use the canonical arguments form.
- privacy.html: GA4 section (both languages) covering recipients, DPF
  transfer basis, cookies incl. _gcl_au, retention semantics, withdrawal.
- ANALYTICS.md rewritten for the consent architecture; retention and
  automatic-collection wording corrected; account-level data-sharing
  check flagged before first production traffic.
- 18 contract tests (node --test), incl. no-side-effect-on-import and
  full consent lifecycle.
@TueJon
TueJon changed the base branch from main to fix/legal-compliance July 24, 2026 18:32
@TueJon TueJon added the legal Legal/compliance work (Impressum, Datenschutz, consent) label Jul 24, 2026
@TueJon
TueJon changed the base branch from fix/legal-compliance to main July 24, 2026 18:38
@TueJon
TueJon marked this pull request as ready for review July 24, 2026 18:39
@TueJon
TueJon merged commit 65e392c into main Jul 24, 2026
@TueJon
TueJon deleted the feat/privacy-safe-measurement branch July 24, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request legal Legal/compliance work (Impressum, Datenschutz, consent)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant