Add persistent storage for LLM questions and responses via HF Hub backup
Mahdi Naser Moghadasi
76869e7
Fix activity tracking: use sendBeacon for critical activities
Mahdi Naser Moghadasi
9f2bc97
- Use navigator.sendBeacon for page_visit, selector_viewed, and bounced activities
- This ensures activities are tracked even if user leaves quickly
- Update API endpoint to handle both JSON (fetch) and Blob (sendBeacon) requests
- Add fallback to fetch if sendBeacon fails
- This fixes issue where visitors have visits but no activity logs
Add detailed logging for activity tracking to diagnose missing logs
Mahdi Naser Moghadasi
5ff08f6
- Added console logging in trackActivity to see if API calls succeed
- Added logging in writeActivityLog to track database writes
- Added logging in API route to see if requests are received
- Logs will show if activities are being excluded, if database writes fail, or if API calls fail
- Helps diagnose why activity logs show 0 entries
Add activity log statistics endpoint to check how many users have activity logs
Mahdi Naser Moghadasi
4120203
- Added ?stats=true parameter to /api/activity endpoint
- Returns: total activities, unique visitors with activity, activities by type, top visitors
- Helps diagnose why activity logs might be missing for some visitors
Add comprehensive user activity tracking system
Mahdi Naser Moghadasi
eef698a
- Created user_activity_log database table for storing all user activities
- Added activity tracking API endpoint (POST/GET /api/activity)
- Created client-side activity tracker with functions for:
- Code changes (typing), code execution, code submission
- LLM questions and responses
- Question selection, page navigation, view changes
- Button clicks, beta signups, feedback submissions
- Integrated activity tracking into:
- app/page.tsx (code changes, executions, submissions, navigation)
- components/AIAssistantChat.tsx (LLM interactions)
- Updated dashboard to show activity logs per visitor with timeline view
- All activities tracked with timestamps, device info, and full context