Skip to main content

Documentation Index

Fetch the complete documentation index at: https://revlytics.co/docs/llms.txt

Use this file to discover all available pages before exploring further.

A public REST API for querying analytics data is planned. Currently, analytics data is queried internally by the dashboard via server components that directly query ClickHouse.

Current architecture

The dashboard uses Next.js server components to query ClickHouse directly. Each dashboard page constructs SQL queries with time-range filters and breakdowns.

Planned public API

The following endpoints are planned for the public API:
EndpointDescription
GET /api/v1/statsSummary stats (visitors, pageviews, bounce rate)
GET /api/v1/timeseriesTime series data for charts
GET /api/v1/pagesTop pages breakdown
GET /api/v1/referrersTraffic sources
GET /api/v1/countriesGeographic breakdown
GET /api/v1/devicesBrowser, OS, device breakdown
GET /api/v1/eventsCustom events breakdown
GET /api/v1/vitalsWeb Vitals data

Query parameters (planned)

ParameterTypeDescription
site_idstringSite to query
periodstringtoday, 7d, 30d, custom
fromstringStart date (ISO 8601)
tostringEnd date (ISO 8601)
filtersstringFilter expression

Direct ClickHouse access (self-hosted)

If you’re self-hosting, you can query ClickHouse directly for custom analysis:
SELECT
  toDate(timestamp) AS date,
  count() AS pageviews,
  uniq(visitor_id) AS visitors
FROM events
WHERE site_id = 'your-site'
  AND timestamp >= now() - INTERVAL 30 DAY
  AND event_type = 'pageview'
GROUP BY date
ORDER BY date