Skip to content

Real-Time Analytics

The Real-Time Analytics API provides live visitor counts, event streams, and page view activity. Data reflects the last 5–30 minutes of activity and is cached for 10 seconds.

All endpoints require an OAuth 2.0 Bearer token.

Active Visitors

Returns the count of unique visitors active in the last 5 minutes.

GET /v1/analytics/realtime/active-visitors

Authentication: OAuth Bearer

Scope: insightcore:reports.read

Rate Limit: 100/min

Cache: 10 seconds

Response

json
{
  "data": {
    "active_visitors": 47
  }
}

Response Fields

FieldTypeDescription
active_visitorsintegerCount of distinct visitors with activity in the last 5 minutes

Live Events

Returns recent events across all event types for the last 30 minutes.

GET /v1/analytics/realtime/events

Authentication: OAuth Bearer

Scope: insightcore:reports.read

Rate Limit: 100/min

Response

json
{
  "data": [
    {
      "type": "page_view",
      "url": "https://mystore.com/products/organic-bananas",
      "title": "Organic Bananas",
      "visitor_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "country": "US",
      "city": "San Francisco",
      "device_type": "desktop",
      "timestamp": "2026-03-26T14:32:15Z"
    },
    {
      "type": "add_to_cart",
      "url": "https://mystore.com/products/organic-bananas",
      "product_id": "prd_00000k1L2m3N4o5",
      "product_name": "Organic Bananas",
      "visitor_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "country": "US",
      "city": "San Francisco",
      "device_type": "desktop",
      "timestamp": "2026-03-26T14:32:28Z"
    }
  ]
}

Response Fields

Each event object includes:

FieldTypeDescription
typestringEvent type
urlstringPage URL
visitor_idstringAnonymous visitor identifier
countrystringVisitor country (from GeoIP)
citystringVisitor city (from GeoIP)
device_typestringdesktop, mobile, or tablet
timestampstringISO 8601 event timestamp

Additional fields vary by event type (e.g., product_id for ecommerce events).

Page Views Per Minute

Returns page view counts aggregated per minute for the last 30 minutes.

GET /v1/analytics/realtime/page-views

Authentication: OAuth Bearer

Scope: insightcore:reports.read

Rate Limit: 100/min

Response

json
{
  "data": [
    { "minute": "2026-03-26T14:00:00Z", "views": 23 },
    { "minute": "2026-03-26T14:01:00Z", "views": 31 },
    { "minute": "2026-03-26T14:02:00Z", "views": 18 },
    { "minute": "2026-03-26T14:03:00Z", "views": 27 }
  ]
}

Response Fields

FieldTypeDescription
minutestringStart of the minute bucket (ISO 8601)
viewsintegerNumber of page views in that minute

Changelog
DateChange
2026-03-26Initial publication.

ShopHero CommerceCore Platform