- Collect detailed bounce feedback data (scroll, time, interactions)
- Pass bounceFeedback to analytics API
- Enhanced bounce tracking with implicit feedback collection
Add UTM parameter recovery from request URL in addition to cookies and referrer
Mahdi Naser Moghadasi
731d501
Add server-side UTM parameter recovery from cookies and referrer URL
Mahdi Naser Moghadasi
f2c3a91
Add full request body logging to debug UTM parameter transmission
Mahdi Naser Moghadasi
1ad71ee
Add logging for visits without UTM parameters to debug tracking
Mahdi Naser Moghadasi
22b289f
Add debug logging for UTM parameter tracking
Mahdi Naser Moghadasi
28b6fd5
Track multiple ad clicks per visitor: allow multiple visits per day with different UTM campaigns, add API endpoint to query visits by visitor ID
Mahdi Naser Moghadasi
703eaa8
Preserve totalVisitsBeforeExclusions in date-filtered analytics
Mahdi Naser Moghadasi
86e1b96
Include totalVisitsBeforeExclusions in API response
Mahdi Naser Moghadasi
0f7c976
- Add to both POST and GET handlers
- Include in filtered analytics when date filter is applied
- This allows dashboard to show both filtered and unfiltered totals
Remove duplicate geographic stats queries - use filtered stats from readAnalyticsFromDB
Mahdi Naser Moghadasi
207f951
- Remove redundant countryStats and usStateStats queries in API route
- Use stats already filtered by date from readAnalyticsFromDB
- Simplifies code and ensures consistency
Add date filtering to geographic stats (country and US state maps)
Mahdi Naser Moghadasi
acc74af
- Update readAnalyticsFromDB to accept filterDate parameter
- Filter countryStats and usStateStats by date when filterDate is provided
- Use filtered stats from readAnalyticsFromDB instead of separate queries
- Maps will now show aggregated data for selected day or all time based on filter
Fix geolocation: Handle 403 error and improve IP extraction
Mahdi Naser Moghadasi
c9e76a9
- Try HTTP fallback when HTTPS returns 403 (ip-api.com free tier requirement)
- Improve x-forwarded-for parsing to try all IPs in chain
- Better logging for private IP detection
- Reduce header logging spam (only when DEBUG_GEO is set)
Add comprehensive debug logging for geolocation
Mahdi Naser Moghadasi
50e2414
- Log IP extraction result
- Log geolocation API response
- Log all request headers when IP not found
- Log what geographic data is being stored
- Increase timeout to 5 seconds for better reliability
- Helps diagnose why geographic data isn't being stored
Add debug logging for IP extraction
Mahdi Naser Moghadasi
84ff9b7
- Log IP-related headers when DEBUG_GEO env var is set
- Helps diagnose IP extraction issues on Hugging Face Spaces
Fix geolocation: Use HTTPS and add debug logging
Mahdi Naser Moghadasi
b73bea0
- Change geolocation API from HTTP to HTTPS for better compatibility
- Add debug logging to track geolocation calls and results
- Increase timeout to 3 seconds for better reliability
- Log when IP is not found or geolocation fails
Add geographic tracking and map visualizations
Mahdi Naser Moghadasi
f8c10e0
- Add IP geolocation tracking using ip-api.com
- Store country, state, city, and coordinates in database
- Add countryStats and usStateStats to analytics API
- Filter geographic stats by date when date filter is applied
- Create world map and US state map visualizations in dashboard
- Support both total and per-day geographic views
Filter referrer stats by date when date filter is applied
Mahdi Naser Moghadasi
afc71d6
- Query analytics_visits with visit_date filter for referrer stats
- Filter both referrerStats and referrerCategoryStats by date
- Ensures Traffic Sources section shows per-day data when date filter is active
Add debug info to API response for LLM questions query
Mahdi Naser Moghadasi
6fefb81
- Include debug information in API response instead of just console.log
- Shows why questions aren't found (date range, available activity types)
- Helps diagnose why llmQuestionsByUser is empty
Improve LLM questions query with better debugging
Mahdi Naser Moghadasi
5f3007e
Add debug logging to check available activity types for LLM users
Mahdi Naser Moghadasi
9e04295
Fix LLM questions query to use date() function and add debug logging
Mahdi Naser Moghadasi
28a4d19
Fix TypeScript error for llmUsageByVisitor property
Mahdi Naser Moghadasi
091c4b9
Add LLM questions breakdown by user for date-filtered queries
Mahdi Naser Moghadasi
78d4c4b
- Query user_activity_log for llm_question activities on specific date
- Include question text, questionId, mode, and timestamp
- Return top 10 questions per top 5 LLM users
- Helps analyze what users are asking the LLM
Add llmUsageByVisitor to API response object
Mahdi Naser Moghadasi
481ac70
Include llmUsageByVisitor in API response
Mahdi Naser Moghadasi
ccf63e6
Add LLM usage breakdown by visitor for date-filtered queries
Mahdi Naser Moghadasi
af29a83
- Add query to get LLM usage count per visitor for specific date
- Include llmUsageByVisitor in API response when date filter is applied
- Helps analyze if LLM usage is concentrated in few users or distributed
Filter LLM usage and beta signups by date when date filter is applied
Mahdi Naser Moghadasi
4dd1bd7
- Add date filtering for llmUsageCount when filterDate is provided
- Add date filtering for betaSignups when filterDate is provided
- Query analytics_llm_usage and analytics_beta_signups tables with date filter
- Fixes issue where LLM and signup counts showed all-time values even when viewing single date
Fix 500 error in analytics API with date filter and breakdown
Mahdi Naser Moghadasi
f60f07b
- Add try-catch around date filtering to prevent crashes
- Query database directly for visitors on specific date instead of inferring from firstVisit/lastVisit
- Fix SQL parameter binding for nested subqueries in breakdown query
- Add date filtering to activity breakdown, button clicks, and tour interactions queries
- Add comprehensive error logging for debugging
- Return empty breakdown on error instead of failing entire request
Add date filter and non-engaged breakdown to dashboard
Mahdi Naser Moghadasi
2daef62
- Add checkbox to toggle between 'all data (total only)' vs 'selected day only'
- Add date picker when 'selected day' mode is selected
- Filter all analytics data by date when date is selected
- Show/hide per-day breakdowns based on mode
- Display non-engaged visitors breakdown with activity types, button clicks, and tour interactions
- API supports date filtering for non-engaged breakdown queries
Add breakdown of non-engaged visitors to analytics API
Mahdi Naser Moghadasi
bc90d03
- New query parameter: ?breakdown=true
- Shows what visitors who didn't start questions actually did
- Breakdown by activity type, button clicks, and tour interactions
- Helps understand why 511 visitors didn't start questions
Fix analytics tracking: traffic sources, button clicks, and bounce rate
Mahdi Naser Moghadasi
4fcb5a2
- Fixed traffic source tracking: Use COALESCE to include Direct visits even if referrer_category is NULL
- Improved button click tracking: Added logging and ensured API handles both JSON and Blob requests
- Enhanced bounce rate tracking: Multiple detection methods (beforeunload, pagehide, visibilitychange, timeout-based)
- Added debug logging for button clicks and bounces
- Bounce detection now only triggers if user hasn't interacted with the page
Fix session duration calculation and add engagement analytics
Mahdi Naser Moghadasi
f98fe13
- Fixed session duration bug: now uses created_at timestamps instead of dates
- Added engagement tracking: selector views and bounces
- Added analytics_engagement table to database schema
- Track when users view selector page but don't start questions
- Track when users bounce (leave without starting)
- Added engagement metrics to dashboard: engagement rate, bounce rate, funnel chart
- Dashboard shows insights for high bounce/low engagement rates
- Session duration now shows accurate time spans (days, hours, minutes)
Add button click tracking for Deep Discussion and Ask Question buttons
Mahdi Naser Moghadasi
af25c18
- Added analytics_button_clicks table to database schema
- Created trackButtonClick() function in analytics.ts
- Added button click tracking to both buttons in page.tsx
- Updated analytics API to accept and store button clicks
- Added buttonClicks to AnalyticsData interface
- Added button click statistics section to Streamlit dashboard
- Dashboard shows: total clicks, Deep Discussion clicks, Ask Question clicks
- Includes bar chart and pie chart for button click distribution
Add analytics data persistence to HF Hub (visits, referrers, questions, LLM usage)
- Track which questions each user views
- Track OS and browser information
- Track device type (desktop/mobile/tablet)
- Track LLM usage when AI assistant is used
- Enhanced admin dashboard with:
- Device statistics (desktop/mobile/tablet)
- OS and browser breakdowns
- Most viewed questions
- LLM usage count
- Individual visitor details with questions viewed and LLM interactions
- Add analytics utility functions for tracking
- Parse user agent to extract device/OS/browser info
Improve analytics file path handling and error logging
Mahdi Naser Moghadasi
2c66ff4
- Better file path resolution for /app/data vs /tmp
- Add console logging to debug file writes
- Check /tmp as fallback when reading
- Better error handling for file operations
Fix analytics permission error - use /tmp as fallback
Mahdi Naser Moghadasi
002f6bd
- Create data directory in Dockerfile with proper permissions
- Add fallback to /tmp if /app/data is not writable
- Handle EACCES/EPERM errors gracefully
- Works on Hugging Face Spaces where /app is read-only
Add interview role-playing and analytics tracking
Mahdi Naser Moghadasi
956cd1e
- Add interview role-playing mode (interviewee/interviewer)
- Interviewer role: Acts as technical interviewer asking questions
- Interviewee role: Coaches candidate on communication
- Add analytics API to track site visits
- Add Analytics component showing total visits, unique visitors, visits today
- Update AI assistant to support role-based conversations
- Add 'End Practice' button to exit interview mode