Analytics Dashboard
The /analytics page is a password-protected dashboard showing route performance insights.
Authentication
- Requires the
ANALYTICS_PASSWORDenvironment variable - Password is entered in a login form and stored in
sessionStorage(per-tab, lost on browser close) - The password is sent as a query parameter to
/api/analytics/dashboard
Tabs
Overview (Resum)
Core KPI cards with sparklines:
- Total views, downloads, shares
- Share modal opens, route start clicks
- Percentage change vs. previous period (green/red/gray pill)
- Top pages by views
Visits (Visites)
Per-route ranked table sorted by views, with download and share counts.
Downloads (Descarregues)
Per-route ranked table sorted by downloads.
Actions (Accions)
Share channel breakdown showing which platforms users share to.
Sessions
PostHog session recordings list showing:
- Duration, click count, keypress count
- Link to replay in PostHog
Period selector
| Period | Date range | Granularity |
|---|---|---|
all | All time | week |
year | Last 365 days | week |
90d | Last 90 days | week |
month | Last 30 days | day |
week | Last 7 days | day |
day | Last 24 hours | day |
Granularity switches to “day” for periods of 30 days or fewer, “week” otherwise.
Comparison periods
For any period except “all”, the dashboard also fetches the equivalent previous period (e.g., this month vs. last month) and shows percentage change indicators.
Data source
The dashboard API (/api/analytics/dashboard) runs 6 parallel PostHog HogQL queries:
- Core totals: countIf per event type (track_viewed, track_downloaded, etc.)
- Per-route breakdown: Group by
properties.gpx_url - Time-series: Group by date/week with
countIfper event type - Share channels: Group by
properties.share_channel - Top pages: Group by
properties.page_url, limit 20 - Comparison: Previous period stats
All queries filter out internal users (where is_internal is not true).