Skip to main content

Site Analytics APIs

Site Analytics

Site-scoped events, metrics, timeseries, and aggregated dashboard views.

Audience: Teams building site-level analytics dashboards and diagnostics.

Critical: All endpoints are under /api/v1/analytics/sites/:siteId and require analytics permission.

Who This Page Is For

Use this page when you need direct site-level event streams and aggregate metrics for custom analytics pages or internal dashboards.

Quick Start (2-5 Minutes)

1

Fetch site metrics

Load unified KPI metrics for selected lookback.

GET /api/v1/analytics/sites/:siteId/metrics?days=30
2

Fetch site events

Get paged event feed with optional event/entity filters.

GET /api/v1/analytics/sites/:siteId/events?limit=100&offset=0&eventType=product_view
3

Fetch event type counts

Get type-level distribution for quick diagnostics.

GET /api/v1/analytics/sites/:siteId/events/types?days=30
4

Fetch timeseries

Render timeline charts for event flows.

GET /api/v1/analytics/sites/:siteId/events/timeseries?range=30d&eventType=purchase
5

Fetch advanced dashboard aggregate

Use root site analytics endpoint for composite dashboard payload.

GET /api/v1/analytics/sites/:siteId?timeRange=7d

Site analytics endpoints

GET /api/v1/analytics/sites/:siteId/datalayer/events
GET /api/v1/analytics/sites/:siteId/events/types
GET /api/v1/analytics/sites/:siteId/events
GET /api/v1/analytics/sites/:siteId/metrics
GET /api/v1/analytics/sites/:siteId/events/timeseries
GET /api/v1/analytics/sites/:siteId

Required Fields / Minimum Payload

FieldRequiredTypeUsed by eventsDescription
siteIdRequireduuidAll site analytics endpointsSite boundary for all analytics output.
days or timeRangeOptionalnumber or 24h|7d|30dmetrics and root aggregate endpointTime window selector for aggregate output.
limit / offsetOptionalnumberevents and datalayer/eventsPagination controls.
eventType / entityTypeOptionalstringevents and timeseriesFilter controls for focused analysis.
rangeOptionalstringevents/timeseriesPreset range for timeline aggregation.

Event or Endpoint Decision Matrix

ScenarioUse ThisWhy
Need raw-ish event feed/analytics/sites/:siteId/eventsPaged event stream for investigation.
Need KPI cards/analytics/sites/:siteId/metricsUnified metric payload for summary UI.
Need timeline charts/analytics/sites/:siteId/events/timeseriesTime bucketed trend data.
Need event taxonomy snapshot/analytics/sites/:siteId/events/typesEvent type volume distribution.
Need single composite payload/analytics/sites/:siteIdAggregated dashboard response for advanced page.

Common Errors and Fixes

Events endpoint latency spikes

Cause: Large limit with broad no-filter queries.

Fix: Use reasonable limit and scoped filters.

Timeseries chart seems flat

Cause: Event filter too narrow or low-volume event type.

Fix: Remove eventType filter and re-check baseline.

Root aggregate endpoint not matching cards

Cause: Different days/timeRange parameters used across calls.

Fix: Align parameters for consistent outputs.

Datalayer events unexpectedly empty

Cause: Data layer integration disabled or not emitting events.

Fix: Verify data-layer integration config and runtime event pushes.

Production Checklist

  • Site dashboards define consistent default range values.Required
  • Events queries are paginated and filtered to prevent heavy payloads.Required
  • Timeseries and KPI cards use aligned windows.Required
  • Datalayer event monitoring is included in integration QA.Required
  • Site access permissions are validated for all analytics consumers.Required

Next Steps