Get User Analytics
User API
Get User Analytics
Retrieve comprehensive learning analytics including time tracking, course breakdown, and daily statistics
GET
Get User Analytics
Authentication
This endpoint requires authentication via Clerk. TheuserId is automatically extracted from the authentication token.
Response
Indicates whether the request was successful
Analytics data object
Error message if success is false
Response Example
Error Codes
| Status Code | Description |
|---|---|
| 200 | Success |
| 401 | Unauthorized - Invalid or missing authentication token |
| 500 | Internal server error |
Analytics Calculation Details
Page Filtering
The following pages are excluded from analytics calculations:- Home
- Browse Courses
- Course Details
- Analytics
- Other
Course Learning Time
Tracked from sessions where the path starts with/player/:courseId
Quiz Time
Tracked from sessions where the path starts with/quiz/:courseId/:chapterId
Daily Statistics
Provides a 7-day rolling window with data for each day, even if duration is 0Sorting
- pageStats: Sorted by
totalDuration(descending) - courseBreakdown: Sorted by total time (learning + quiz duration, descending)
- chapters: Sorted by
quizDuration(descending)
Use Cases
- Display user’s learning dashboard
- Track study habits and patterns
- Identify most engaged courses
- Generate progress reports
- Visualize daily learning trends
- Show chapter-level quiz performance