Insights
The Insights API provides access to website analytics data including metrics, page views, visitor statistics, and detailed breakdowns by various dimensions.
Authentication
To authenticate with the Insights API, you need to use your clientId
and clientSecret
. Make sure your client has read
or root
mode. The default client does not have access to the Insights API.
For detailed authentication information, see the Authentication guide.
Include the following headers with your requests:
openpanel-client-id
: Your OpenPanel client IDopenpanel-client-secret
: Your OpenPanel client secret
Base URL
All Insights API requests should be made to:
Common Query Parameters
Most endpoints support the following query parameters:
Parameter | Type | Description | Default |
---|---|---|---|
startDate | string | Start date (ISO format: YYYY-MM-DD) | Based on range |
endDate | string | End date (ISO format: YYYY-MM-DD) | Based on range |
range | string | Predefined date range (7d , 30d , 90d , etc.) | 7d |
filters | array | Event filters to apply | [] |
cursor | number | Page number for pagination | 1 |
limit | number | Number of results per page (max: 50) | 10 |
Filter Configuration
Filters can be applied to narrow down results. Each filter has the following structure:
Endpoints
Get Metrics
Retrieve comprehensive website metrics including visitors, sessions, page views, and engagement data.
Query Parameters
Parameter | Type | Description | Example |
---|---|---|---|
startDate | string | Start date for metrics | 2024-01-01 |
endDate | string | End date for metrics | 2024-01-31 |
range | string | Predefined range | 7d |
filters | array | Event filters | [{"name":"path","operator":"is","value":["/home"]}] |
Example Request
Response
Get Live Visitors
Get the current number of active visitors on your website in real-time.
Example Request
Response
Get Top Pages
Retrieve the most visited pages with detailed analytics including session count, bounce rate, and average time on page.
Query Parameters
Parameter | Type | Description | Example |
---|---|---|---|
startDate | string | Start date | 2024-01-01 |
endDate | string | End date | 2024-01-31 |
range | string | Predefined range | 7d |
filters | array | Event filters | [] |
cursor | number | Page number | 1 |
limit | number | Results per page (max: 50) | 10 |
Example Request
Response
Get Referrer Data
Retrieve referrer analytics to understand where your traffic is coming from.
Example Request
Response
Get UTM Campaign Data
Analyze your marketing campaigns with UTM parameter breakdowns.
Example Request
Response
Get Geographic Data
Understand your audience location with country, region, and city breakdowns.
Example Request
Response
For region and city endpoints, an additional prefix
field may be included:
Get Device & Technology Data
Analyze visitor devices, browsers, and operating systems.
Example Request
Response
For version-specific endpoints (browser_version, os_version), a prefix
field shows the parent:
Error Handling
The API uses standard HTTP response codes. Common error responses:
400 Bad Request
401 Unauthorized
429 Too Many Requests
Rate limiting response includes headers indicating your rate limit status.
Rate Limiting
The Insights API implements rate limiting:
- 100 requests per 10 seconds per client
- Rate limit headers included in responses
- Implement exponential backoff for retries
Notes
- All dates are returned in ISO 8601 format
- Durations are in seconds
- Bounce rates and percentages are returned as decimal numbers (e.g., 45.2 = 45.2%)
- Session duration is the average time spent on the website
- All timezone handling is done server-side based on project settings