Skip to content

feat: wire KPI telemetry — web-vitals RUM + missing events + POST sink #51

Description

@OmarEhab007

Problem

The telemetry system fires DOM events locally but has no production sink. Two PRD KPI events are defined but never fired:

  • `core_workflow_complete` — defined in types, never dispatched
  • `time_to_first_insight_seconds` — not even defined yet

Without these, the PRD success metrics (adoption rate, time-to-insight, usability score) cannot be measured.

Scope

  1. Add `web-vitals` package — report LCP, INP, CLS via `trackEvent`
  2. Add `time_to_first_insight_seconds` event — measure from `dashboard_render_complete` to first detail navigation
  3. Fire `core_workflow_complete` in the log explorer on workflow completion
  4. Extend `trackEvent` to POST to `NEXT_PUBLIC_TELEMETRY_URL` when set (no-op if unset)
  5. Tests for all new telemetry paths

Acceptance Criteria

  • `web-vitals` installed; LCP/INP/CLS reported via `trackEvent` on every page
  • `time_to_first_insight_seconds` fires when user reaches first detail view from dashboard
  • `core_workflow_complete` fires in log explorer on workflow completion
  • `trackEvent` POSTs to `NEXT_PUBLIC_TELEMETRY_URL` when env var is set
  • All new paths have Vitest tests
  • 0 lint errors, 0 tsc errors

References

PRD KPIs: `projects/RemedyIQ/prd-ui-refactor-core-focus.md`
Audit gap: `projects/RemedyIQ/audit-refactor-scoping-q1.md` — "No RUM"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions