Skip to Content
AnalyticsDashboard

Analytics Dashboard

The /analytics page is a password-protected dashboard showing route performance insights.

Authentication

  • Requires the ANALYTICS_PASSWORD environment 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

PeriodDate rangeGranularity
allAll timeweek
yearLast 365 daysweek
90dLast 90 daysweek
monthLast 30 daysday
weekLast 7 daysday
dayLast 24 hoursday

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:

  1. Core totals: countIf per event type (track_viewed, track_downloaded, etc.)
  2. Per-route breakdown: Group by properties.gpx_url
  3. Time-series: Group by date/week with countIf per event type
  4. Share channels: Group by properties.share_channel
  5. Top pages: Group by properties.page_url, limit 20
  6. Comparison: Previous period stats

All queries filter out internal users (where is_internal is not true).