Skip to content

feat: track anonymous lesson and quiz engagement in analytics#112

Merged
OpenSauce merged 1 commit intomainfrom
task/74-anonymous-analytics
Feb 22, 2026
Merged

feat: track anonymous lesson and quiz engagement in analytics#112
OpenSauce merged 1 commit intomainfrom
task/74-anonymous-analytics

Conversation

@OpenSauce
Copy link
Owner

Summary

  • Fire lesson_view and lesson_complete analytics events from the lesson page for both anonymous and authenticated users
  • Fire quiz_start and quiz_complete analytics events from the quiz page for both anonymous and authenticated users
  • Add anonymous engagement query to the analytics summary endpoint, returning counts under a new anonymous_engagement key
  • Display an "Anonymous Engagement" section in the admin dashboard with lesson views, quiz starts, and quiz completions

Acceptance Criteria

  • lesson_view event fires on lesson page mount (both anon and auth)
  • lesson_complete event fires when markComplete() succeeds
  • quiz_start event fires on quiz page mount (both anon and auth)
  • quiz_complete event fires after submitQuiz() receives a successful result, with score and total in payload
  • Analytics summary endpoint returns anonymous_engagement with lesson_views, lesson_sessions, quiz_starts, quiz_completions, quiz_sessions
  • Admin dashboard AnalyticsSummary interface updated to include anonymous_engagement
  • Admin dashboard displays "Anonymous Engagement" section with stat cards after Learning Metrics and before Learning Funnel

Test plan

  • Frontend tests pass (57 tests, no regressions)
  • Backend tests pass (157 tests, no regressions)
  • Backend ruff lint clean

Deviations from plan

None

Implements Task 74 from the backlog.

Copilot AI review requested due to automatic review settings February 22, 2026 17:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds anonymous user analytics tracking for lessons and quizzes, enabling the platform to measure engagement from users who haven't signed up. The implementation tracks key user interactions (lesson views, lesson completions, quiz starts, and quiz completions) through the existing analytics event system, aggregates this data in the backend analytics summary endpoint, and displays it in a new "Anonymous Engagement" section on the admin dashboard.

Changes:

  • Frontend: Added analytics event tracking for lesson views/completions and quiz starts/completions using the useAnalytics composable
  • Backend: Extended the analytics summary endpoint with a new SQL query to aggregate anonymous engagement metrics from the event table
  • Admin UI: Added a new "Anonymous Engagement" section displaying lesson views, quiz starts, and quiz completions with session counts

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
frontend/pages/lesson/[slug].vue Added lesson_view event on mount and lesson_complete event after successful completion
frontend/pages/quiz/[slug].vue Added quiz_start event on mount and quiz_complete event after successful submission with score data
frontend/pages/admin.vue Extended AnalyticsSummary interface and added UI section to display anonymous engagement metrics
backend/app/api/analytics.py Added SQL query to count anonymous lesson/quiz events and included results in summary endpoint response

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@OpenSauce OpenSauce force-pushed the task/74-anonymous-analytics branch from 095d3d3 to f5f33d4 Compare February 22, 2026 17:44
@OpenSauce OpenSauce merged commit ebefe7e into main Feb 22, 2026
3 checks passed
@OpenSauce OpenSauce deleted the task/74-anonymous-analytics branch February 22, 2026 17:46
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