Skip to content

First-party analytics events + Vitals dashboard v2 #133

Description

@truthixify

Tier: L (5-7 days) | Type: feature

Context. Wave 7 shipped an untyped trackEvent wrapper in src/analytics.ts around window.plausible, and a Web Vitals dashboard v1 at /vitals (src/pages/Vitals.tsx) that already has a per-page filter (selectedPage, lines 39 and 220-226) sourced from src/data/vitalsData.ts. Two gaps: (a) the generic trackEvent wrapper is not typed and is not DNT-aware on its own (DNT-checking currently lives inside useVitals.ts line 60, only for Vitals emissions), so any new caller has to remember to check DNT; (b) v1 has no per-locale filter, no event conversion tiles, and no way to correlate perf to incidents. Wave 9 content decisions need this to graduate from guessing.

Scope.

  • Small typed event helper src/utils/track.ts: named events with strict TS payloads; wraps the existing trackEvent from src/analytics.ts; lifts the DNT check out of useVitals.ts so it applies to every named event; no-ops when the analytics script is not loaded.
  • Instrument a documented set of conversion events: cta_click (with source), newsletter_submit, newsletter_confirm, blog_post_read (fires on scroll depth 80%), calculator_share, chain_matrix_sort, outbound_click (grouped by destination category).
  • Vitals dashboard v2 at /vitals: keeps the existing per-page filter, adds per-locale filter, adds event conversion tiles alongside the existing LCP/INP/CLS charts, and a 30-day incident overlay from the status page (issue i18n scaffolding + Spanish locale baseline #10).
  • Documentation on /privacy and /security updated to enumerate every event name, payload schema, retention, and the exact endpoint it hits.
  • No new third-party requests; everything goes to the same first-party analytics endpoint already in use.

Acceptance.

  • Every documented event fires exactly once per intended user action (Playwright coverage)
  • DNT header set: zero network requests to the analytics endpoint (Playwright test fails otherwise)
  • /vitals v2 renders per-page + per-locale filters, event tiles, and the incident overlay
  • /privacy lists every event name and payload
  • Build passes
  • Lighthouse Perf/SEO stay >= 90 on /vitals

Files. src/utils/track.ts (new), src/pages/Vitals.tsx, src/hooks/useVitals.ts, src/pages/Privacy.tsx, src/pages/Security.tsx (see issue #1), instrumented components across src/components/ and src/pages/, e2e/analytics.spec.ts (new).

Activity

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programanalyticsdripsFunded via Drips NetworkfeatureNew feature workhelp wantedExtra attention is neededperfPerformance / optimizationprivacyPrivacy-specific workstellar-waveAuto-created for Wave 8wave-8Auto-created for Wave 8wwwAuto-created for Wave 8

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions