Skip to content

Analytics

Analytics is the audience view for a project: who is visiting, where they come from, and what they browse with. Like Metrics, analytics is captured server-side by the PandaStack gateway from request headers — there is no tracking script to add to your site.

  • The gateway logs each request into the same ClickHouse event log (pandastack.request_events) used by Metrics, forwarding the request headers (user-agent, referer, country) so audience dimensions can be derived.
  • Analytics is per-project and tenant-safe: the project is resolved and ownership-checked in Postgres before any ClickHouse query, which is then filtered by project name.
  • Bots are excluded from audience counts (is_bot = 0), except for the dedicated botViews figure.
  • Analytics fails open: if ClickHouse is unconfigured, endpoints return an empty shape with enabled: false.

Analytics is gated twice, so an empty response can mean two different things:

  1. Plan gate — analytics is a paid feature. Free organizations receive a 402 (quota_exceeded) upgrade prompt.
  2. Per-project toggle — each project has an enable_analytics flag. When it is off, the API returns empty data with analyticsEnabled: false (not an error) so the dashboard can show an “enable analytics” prompt rather than a failure.

So enabled reflects whether ClickHouse is configured platform-wide, while analyticsEnabled reflects whether this specific project has analytics turned on.

Analytics reuses the same ranges and bucket widths as Metrics:

rangeWindowBucket width
1h1 hourPer-minute
24h24 hours10-minute
7d7 daysHourly
30d30 days6-hour
FieldMeaning
uniqueVisitorsDistinct visitors in the range.
totalViewsNon-bot request count.
botViewsRequests identified as bots.
returningVisitorsVisitors with more than one view.
viewsPerVisitorAverage views per visitor.
enabledClickHouse configured platform-wide.
analyticsEnabledThis project has analytics turned on.

The analytics time series returns one point per bucket, each with visitors and views (nullable). Counts zero-fill empty buckets so charts draw to the baseline.

Each breakdown is a list of { label, visitors, views } rows:

BreakdownDerived from
Top countriesVisitor geography (shown with country flags in the dashboard).
Top referrersThe referer header.
Top pagesRequested paths.
BrowsersParsed user-agent browser (ua_browser).
DevicesParsed user-agent device (ua_device).
AnalyticsMetrics
Question answeredWho is visiting?How is the service performing?
Typical fieldsVisitors, countries, referrers, browsers, devicesRequests, error rate, latency, bandwidth, RPS
BotsExcluded (except botViews)Counted as requests
GatingPaid plan and per-project toggleAvailable to all plans (no separate toggle)
SourceClickHouse request_events (server-side, no SDK)ClickHouse request_events (server-side, no SDK)