Skip to content

Add metrics tracking for game completions and daily player stats - #85

Open
Osireg17 wants to merge 2 commits into
developfrom
Osi/metrics-tracking-branch-clean
Open

Add metrics tracking for game completions and daily player stats#85
Osireg17 wants to merge 2 commits into
developfrom
Osi/metrics-tracking-branch-clean

Conversation

@Osireg17

@Osireg17 Osireg17 commented May 23, 2026

Copy link
Copy Markdown

This pull request adds new metrics tracking and reporting features to the application, including tracking game completion events and displaying the daily player count. It introduces utility functions and components for handling anonymous user identification and fetching player statistics, and integrates these into the game flow.

Metrics tracking and reporting:

  • Added a new UuidUtil utility in uuid-util.ts to generate and persist a unique anonymous user ID in local storage for tracking purposes.
  • Updated the main game logic in game.tsx to send a POST request to the metrics service when a game is completed or the guess limit is reached, including user UUID, passage ID, stars, guesses, and win status. (src/app/play/[game]/game.tsxR23, src/app/play/[game]/game.tsxR237-R255)
  • Introduced a server action track-completion.ts to send completion events to the metrics service, supporting both logged-in and anonymous users.

Player statistics display:

  • Added a new PlayerCount client component that fetches and displays the number of players for the current day, refreshing every 5 minutes.
  • Created a server action get-daily-stats.ts to fetch daily player statistics from the metrics service, and defined the DailyPlayerStats model. [1] [2]

@vercel

vercel Bot commented May 23, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
dev.bible.game Ready Ready Preview, Comment May 23, 2026 11:41am
exp.bible.game Ready Ready Preview, Comment May 23, 2026 11:41am

@Osireg17
Osireg17 requested a review from jrsmth May 23, 2026 11:39
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.

1 participant