Use this endpoint to retrieve per-campaign analytics for a specified time period. The response returns variant-level metrics, including impressions, conversions, revenue, and A/B test significance for each campaign variation within the selected date range.
This endpoint returns data equivalent to the Campaign Analytics view in the InOne panel for OnSite campaigns. For aggregated site-level analytics, see Get Overall OnSite Analytics.
Endpoint and Headers
Visit our Postman collection to test this request.
Headers
Header | Sample Value | Description |
|---|---|---|
X-INS-AUTH-KEY | 1a2b3c4d5e6f | This key is required to authorize your request. Refer to API Authentication Tokens to generate your token. |
Query Parameters
Parameter | Data Type | Description | Required |
|---|---|---|---|
startTime | int64 | Start of the analytics date range as a 10-digit Unix epoch timestamp | Yes |
endTime | int64 | End of the analytics date range as a 10-digit Unix epoch timestamp. When omitted, defaults to the current time at the point of the request | No |
campaignBuilderId | Integer | The builder ID of the campaign to retrieve analytics for. Find this value in the InOne panel by opening the campaign and copying the numeric ID from the URL, or from the builderId field in the Get Overall OnSite Analytics response. | Yes |
Sample Request
Before sending the request, make sure:
To replace the authorization value with your own OnSite Campaign Analytics API key.
To replace the sample values in campaignBuilderId, startTime, and endTime with your own values in the required data type.
curl --location --request GET 'analytics.api.useinsider.com/onsite/v1/campaign?startTime=1633471200&endTime=1649195999&campaignBuilderId=119283'
2--header 'X-INS-AUTH-KEY: 1a2b3c4d5e6f'Sample Responses
200 OK
{
"data": {
"detail": {
"9": {
"119283": [
{
"conversion": 166400.0,
"significance": 0.0,
"averageOrderValueUplift": 0.0,
"bayesianSignificance": 0.9999,
"leadCount": 0,
"goalConversionRate": 0.3853082697713621,
"incrementalConversion": 0.0,
"averageOrderValue": 0.0,
"goal": "9",
"salesConversion": 229.0,
"conversionRateUplift": 0.0,
"incrementalRevenue": 0.0,
"goalConversion": 166400.0,
"revenue": 0.0,
"conversionRate": 0.3853082697713621,
"salesConversionRate": 0.0005302619818367904,
"campaignId": 119283,
"campaignName": "My campaign",
"platform": "all",
"impression": 431862.0
}
]
}
},
"summary": {
"119283": 39
}
}
}Response structure
The data object contains two top-level keys: detail and summary.
detail object — three-level nesting:
detail └── {goalId} — the ID of the goal being evaluated └── {campaignId} — the campaign variation ID └── [ ] — array of metric objects for that variationIn the sample response above, "9" is the goal ID and "87", "88" are campaign variation IDs.
summary object:
Each key is a campaign variation ID and each value is the Effective Days count — the number of days within the selected date range during which that variation received more than 10 impressions.
Key: Campaign variation ID (e.g. 119283)
Value: Effective Days: number of days the variation received more than 10 impressions
You can refer to Metric Definitions for further details.
400 Bad Request: invalid request
Returned when the request cannot be parsed or validated.
“Sorry, we've received an invalid request from your side. You can try again later.”
Verify that all required parameters are present and that startTime and endTime are valid 10-digit Unix epoch timestamps.
400 Bad Request: invalid campaign ID
Returned when the campaignBuilderId value does not match any campaign in the database.
“Sorry, we detected an invalid Campaign ID in your request. The Campaign ID is not found in the database.”
Confirm your campaign builder ID in the InOne panel by opening the campaign and checking the numeric ID in the URL.
400 Bad Request: validation failure
Returned when the request passes parsing but fails server-side validation.
“Sorry, we couldn't validate the request at the moment. You can try again later.”
Retry the request. If the error persists, submit a support ticket.
406 Not Acceptable: date range exceeds 1 year
Returned when the range between startTime and endTime exceeds 12 months.
“Sorry, we received an invalid request. We are able to provide the analytics data for only the last 1 year.”
Reduce the date range to a maximum of 12 months and resubmit.
500 Internal Server Error
Returned when an unexpected server error occurs. Retry the request after a short wait. If the error persists, submit a support ticket.
“Sorry, we couldn’t receive any response from our server. You can try again later.”
If the error persists, submit a support ticket.
Limitations
All functions must be executed with an HTTPS GET request.
The x-ins-auth-key should be provided as the authorization key in the request header. If the key is incorrect, the operation will not be executed, and an authorization error will return in the response.
The date range between startTime and endTime cannot exceed 12 months.
The rate limit is 100 requests per minute per API key. Exceeding this limit returns a 429 error.
The default limit shown here is a standard baseline. If your use case requires higher capacity, feel free to reach out to the Insider One team — we can adjust it to fit your needs.