Skip to content

feat(analytics): QA visits → traffic_type=internal (reuse Tacko isQaVisit) - #895

Merged
unjica merged 9 commits into
developfrom
fix/ga-qa-traffic-type
Oct 30, 2026
Merged

unjica merged 9 commits into
developfrom
fix/ga-qa-traffic-type

Conversation

@unjica

@unjica unjica commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Base branch: fix/ga-consent-withdrawal (stacked on #894 → #893; all touch GoogleAnalytics.tsx).

Summary

P1 from the Phase 1 analytics audit: TT had no QA/internal tagging, so audit and agent probe hits counted as real traffic.

  • lib/qa-visit.ts ports Tacko's isQaVisit logic: ?qa=1, utm_source=qa / qa_*, or a TackoQA UA → set qa=1 cookie (30 days, Path=/, SameSite=Lax, Secure on https, Domain=.telemetry-tracker.com on the hosted site) + sessionStorage; an existing qa=1 / tacko_qa=1 cookie also counts.
  • GoogleAnalytics.tsx: traffic_type: 'internal' on gtag('config') and on every explicit page_view for QA visits. Only evaluated after Accept (the helper runs only inside the consented GA code path).
  • Withdrawal also deletes the qa cookie; /cookies table lists the qa cookie.

How to test

  • pnpm lint ✅; dashboard vitest ✅ 76 files / 457 tests (new lib/qa-visit.test.ts + GoogleAnalytics QA case); next build ✅.
  • Local consent audit (GA /collect intercepted locally): landing, Link nav and back hits all carry tt=internal; after withdrawal cookies [], 0 hits.

GA4 admin (not code): traffic_type must be registered/used by the Internal Traffic data filter (set to Active) in property 544138170 for these hits to be excluded.

Checklist

  • Tests · [x] Lint · [x] Build (dashboard) · [x] CHANGELOG · [x] No breaking changes

Security / privacy

One new first-party marker cookie, only for QA links and only after consent; disclosed in the cookie policy; removed on withdrawal.

@unjica
unjica changed the base branch from fix/ga-consent-withdrawal to develop October 30, 2026 11:15
@unjica
unjica merged commit a5614fd into develop Oct 30, 2026
7 checks passed
@unjica unjica mentioned this pull request Oct 30, 2026
1 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants