Skip to content

Add analytics tracking, performance metrics, and terminal feedback panel#83

Open
alexwelcing wants to merge 1 commit intomainfrom
codex/define-and-implement-key-analytics-events
Open

Add analytics tracking, performance metrics, and terminal feedback panel#83
alexwelcing wants to merge 1 commit intomainfrom
codex/define-and-implement-key-analytics-events

Conversation

@alexwelcing
Copy link
Copy Markdown
Owner

Motivation

  • Instrument key product events (session_start, chapter_unlock, ai_chat, game_play, game_finish, share) for product analytics and retention analysis.
  • Capture runtime performance signals (FPS averages, navigation/load timing, and asset errors) from the 3D scene so regressions can be monitored.
  • Offer an in-UI feedback surface to collect lightweight user input and share actions directly from the terminal.
  • Provide a short guide for how events map to retention reporting so analytics consumers can build dashboards.

Description

  • Added a small analytics helper lib/analytics/trackEvent.ts that forwards events to posthog and gtag (when available) and logs in development.
  • Instrumented app lifecycle and UX events by updating pages/_app.tsx (tracks session_start), components/JourneyContext.tsx (tracks chapter_unlock), and components/TerminalInterface.tsx (tracks ai_chat).
  • Implemented performance tracking inside the 3D scene by adding PerformanceTracker to components/ThreeSixty.tsx to sample FPS, emit periodic performance_metrics, record navigation timings on mount, and report asset load errors.
  • Added a lightweight feedback widget components/FeedbackPanel.tsx and wired it into components/TerminalInterface.tsx, plus updated components/InteractiveTablet.tsx to pass source metadata for game_play events and made game_play/game_finish instrumentation in components/ThreeSixty.tsx.
  • Documented event definitions and a weekly retention reporting suggestion in docs/analytics.md.

Testing

  • Started the local dev server with npm run dev, which compiled and served the app successfully (server up); this validated no TypeScript/runtime compile errors on start.
  • Attempted an automated Playwright script to open the UI and capture a screenshot of the feedback panel, but the headless interaction failed to complete due to intermittent connection/timeout errors (Playwright navigation errors); the script did not succeed.
  • No unit or integration test suites were run as part of this change (no pnpm test/npm test executed).
  • Manual smoke validation performed during development (compile + page load via curl returned HTTP 200) but automated end-to-end coverage remains to be completed.

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
next-docs-search Error Error Dec 20, 2025 7:07pm

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant