Statistics
Overview
The statistics API endpoint provides capability to retrieve near real time metrics and campaign budget cap-out time on the day of request.
Usage: To retrieve near-real time metrics and campaign cap-out insights
To understand details about ‘Request Header' or 'Authorization’, please refer to the Authorization Guide
Retrieve today’s near-real time metrics and campaign cap-out insights
Description: You can retrieve following metrics at advertiser/campaign level in near real-time for the time elapsed on the day of request: "Ad Spend", "Clicks", "Impressions", "Daily Remaining Budget", "Daily Out of budget Date Time"
End Point: /api/v1/stats
HTTP Method: GET
Note:
- We recommend that you do not request near real-time statistics more than once per thirty minutes as the refreshed metrics may not reflect before that
- The Ads exposed attribution is not part of near real-time metrics. Only the Ads performance metrics (Ad Spend, Clicks, Impressions) are provided in near real-time metrics.
- Campaign budget type vs Daily remaining budget values:
- For Campaigns that have only daily budget defined – then Daily Remaining Budget
- For Campaigns that have both total and daily budget defined – then Daily Remaining Budget
- For Campaigns that have only total budget defined – then Daily Remaining Budget is NULL
Query Parameters
| Parameter | Description | Type | Required | Possible Values |
|---|---|---|---|---|
| advertiserId | The ID of the advertiser for whom the ad group(s) should be returned | Integer | Y | Unique numeric identifier |
| campaignId | The ID of the campaign for which the performance metrics for today need to be retrieved | Integer | Y | Unique numeric identifier |
Sample Request
Response
| Element | Description | Type |
|---|---|---|
| campaignId | Id of the advertising campaign whose ad spend is being retrieved | Integer |
| todayAdSpend | The amount of budget spent for current date | Double |
| asOf | Date and time for which the statistics (ad spend, impressions, clicks, daily remaining budget) is requested. Note: The time zone is in PST and time stamp format is 24-hour format |
String |
| adGroupId | Id of the ad group Note: Please ignore this parameter because we now provide stats at campaign level only, and eventually adGroupId will be removed from the response. For now, we will return ‘-1’ for this field. |
Integer |
| dailyOutOfBudgetDatetime | An indicator of whether a campaign has yet run out of its assigned daily budget or not. It returns following values:
|
String |
| dailyRemainingBudget | The amount of daily budget left after today’s ad spend is consumed | Double |
| todayImpressions | Total number of impressions counted for today | Integer |
| todayClicks | Total number of clicks counted for today | Integer |
Sample Response 1
[
{
"campaignId": 500001,
"todayAdSpend":777.0,
"asOf": "2021-07-29 18:44",
"adGroupId": -1,
"dailyOutOfBudgetDatetime": "2021-07-29 15:41",
"dailyRemainingBudget": 17.2,
"todayImpressions": 32421,
"todayClicks": 14
}
]
Sample Response 2
Following campaigns’ daily budget is 500 and todayAdSpend is also 500, so dailyRemainingBudget is 0:
[
{
"campaignId": 1694255,
"adgroupId": -1,
"todayAdSpend": 500.0,
"asOf": "2022-04-12 20:14",
"dailyOutOfBudgetDatetime": "2022-04-12 09:08",
"dailyRemainingBudget": 0.0,
"todayImpressions": 495627,
"todayClicks": 1214
}
]
Sample Response 3
Following campaign has Total Budget defined and Daily Budget is undefined (i.e., Campaign Budget Type: Total). Hence the the Daily Remaining Budget is NULL.
[
{
"campaignId": 531760,
"adgroupId": -1,
"todayAdSpend": 52.0,
"asOf": "2022-04-14 15:18",
"dailyOutOfBudgetDatetime": null,
"dailyRemainingBudget": null,
"todayImpressions": 220,
"todayClicks": 52
}
]
HTTP Status Code
| Status Code | Description | Possible Error Messages |
|---|---|---|
| 400 | Bad Request | <advertiserId> not found in request |
| 403 | Forbidden |
|
| 404 | Not Found | Advertiser not found |
| 429 | Too Many Requests | <Exception Message> |
| 500 | Internal Server Error | There was an error processing the request |