feat: track anonymous lesson and quiz engagement in analytics#112
Merged
feat: track anonymous lesson and quiz engagement in analytics#112
Conversation
There was a problem hiding this comment.
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
useAnalyticscomposable - 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.
095d3d3 to
f5f33d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lesson_viewandlesson_completeanalytics events from the lesson page for both anonymous and authenticated usersquiz_startandquiz_completeanalytics events from the quiz page for both anonymous and authenticated usersanonymous_engagementkeyAcceptance Criteria
lesson_viewevent fires on lesson page mount (both anon and auth)lesson_completeevent fires whenmarkComplete()succeedsquiz_startevent fires on quiz page mount (both anon and auth)quiz_completeevent fires aftersubmitQuiz()receives a successful result, with score and total in payloadanonymous_engagementwith lesson_views, lesson_sessions, quiz_starts, quiz_completions, quiz_sessionsAnalyticsSummaryinterface updated to includeanonymous_engagementTest plan
Deviations from plan
None
Implements Task 74 from the backlog.