curl --request GET \
--url https://api.example.com/api/websites/:id/realtime{
"data": {
"active_visitors": 123,
"recent_events": [
{
"event_type": "<string>",
"url": "<string>",
"referrer_domain": "<string>",
"country": "<string>",
"browser": "<string>",
"device_type": "<string>",
"ts": "<string>"
}
],
"pagination": {
"limit": 123,
"total_in_window": 123
}
}
}Retrieve current active visitors and recent events for real-time monitoring.
curl --request GET \
--url https://api.example.com/api/websites/:id/realtime{
"data": {
"active_visitors": 123,
"recent_events": [
{
"event_type": "<string>",
"url": "<string>",
"referrer_domain": "<string>",
"country": "<string>",
"browser": "<string>",
"device_type": "<string>",
"ts": "<string>"
}
],
"pagination": {
"limit": 123,
"total_in_window": 123
}
}
}pageview or event.desktop, mobile, or tablet (if available).curl -X GET "https://analytics.example.com/api/websites/abc123/realtime" \
-H "Authorization: Bearer spk_live_your_api_key"
{
"data": {
"active_visitors": 47,
"recent_events": [
{
"event_type": "pageview",
"url": "https://example.com/pricing",
"referrer_domain": "google.com",
"country": "US",
"browser": "Chrome",
"device_type": "desktop",
"ts": "2024-03-07T15:42:31.123Z"
},
{
"event_type": "pageview",
"url": "https://example.com/",
"referrer_domain": null,
"country": "GB",
"browser": "Safari",
"device_type": "mobile",
"ts": "2024-03-07T15:42:28.456Z"
},
{
"event_type": "event",
"url": "https://example.com/signup",
"referrer_domain": "twitter.com",
"country": "CA",
"browser": "Firefox",
"device_type": "desktop",
"ts": "2024-03-07T15:42:15.789Z"
},
{
"event_type": "pageview",
"url": "https://example.com/docs/getting-started",
"referrer_domain": "github.com",
"country": "DE",
"browser": "Edge",
"device_type": "desktop",
"ts": "2024-03-07T15:41:52.321Z"
}
],
"pagination": {
"limit": 100,
"total_in_window": 234
}
}
}
total_in_window shows all events in the time window, even though only the most recent 100 are returned