Training
For clients
Загружается...
The v2 statistics API methods allow you to get various statistics for advertising objects.
The v2 statistics API methods allow you to get various statistics for advertising objects.
Restrictions and filters in these methods are set using GET parameters, not in the address body, as in the V1 API.
In case of an error, a response like this is returned:
{ "error": { "message": "message_text", "code": "CODE" }} |
| HTTP code | Code | Description |
| 400 | ERR_WRONG_PARAMETER | Invalid parameter value, or a required parameter was omitted |
| 400 | ERR_LIMIT_EXCEEDED | Exceeded the limit on the requested dates or number of objects |
| 400 | ERR_WRONG_DATE | Invalid date specified |
| 400 | ERR_WRONG_BANNERS | The requested banners do not exist or are not available for this API user |
| 400 | ERR_WRONG_CAMPAIGNS | The requested campaigns do not exist or are not available for this API user |
| 400 | ERR_WRONG_USERS | The user does not exist or statistics on it are not available for this API user |
| 403 | ERR_ACCESS_DENIED | No permissions to access the API method |
| 404 | ERR_WRONG_RESOURCE | The API method does not exist |
| 500 | ERR_INTERNAL | Internal server error |
GET {host}/api/v2/statistics/{banners|campaigns|users}/{day|summary}.jsonThe resource returns total statistics for the entire time of rollback or daily statistics for the selected period for accounts, campaigns, and banners.
Restrictions and filters are set using GET parameters:
| Parameter | Format | Default value | Description |
| date_from | YYYY-MM-DD | Start date. Only for day.json. | |
| date_to | YYYY-MM-DD | End date (inclusive). Only for day.json. | |
| id | comma-separated list of IDs | List of IDs of banners, campaigns, or users. | |
| metrics | comma-separated list of text IDs | base | List of sets of metrics. Available option: all, base, events, video, uniques, tps, playable, romi. |
| attribution | impression | default | to attribute at the time of the event, the time of the impression. Ignored for summary |
All parameters except metrics are required.
You can get all statistical metrics or specific datasets in a single query.
Note: For advertising campaigns with a broadcast pause of more than 90 days, statistics on unique users will not be relevant.
Response structure:
Example request:
GET {host} / api / v3 / statistics / {banners | campaigns | users} /day.json The resource returns summary statistics for the selected period for accounts, campaigns, banners with pagination.
Restrictions and filters are set using GET parameters:
| Parameter | Format | Default | Description |
| date_from | YYYY-MM-DD | & nbsp; | Start date. |
| date_to | YYYY-MM-DD | Current date | End date (inclusive). |
| id | comma separated list of identifiers | & nbsp; | List of banner, campaign, or user IDs. |
| id_ne | comma separated list of identifiers | & nbsp; | List of banner, campaign, or user IDs with negation. |
| fields | list of requested metrics or fields in metric or metric format. field_name comma separated | base | List of metric sets. Available metrics: all, base, events, uniques, video, carousel, tps, moat, playable, romi. |
| attribution | impression | conversion | Attribute by event time, display time. Available options: conversion, impression |
| banner_status | comma separated list of statuses. Available options: all, active, blocked, deleted. | all | List of banner statuses, available for statistics on campaigns and banners. |
| banner_status_ne | comma separated list of statuses. Available options: all, active, blocked, deleted. | all | List of banner statuses with negation, available for campaign and banner statistics. |
| campaign_status | comma separated list of statuses. Available options: all, active, blocked, deleted. | all | List of campaign statuses, available for campaign and banner statistics. |
| campaign_status_ne | comma separated list of statuses. Available options: all, active, blocked, deleted. | all | List of campaign statuses with denial. Available for campaign and banner statistics. |
| campaign_id | comma separated list of identifiers | & nbsp; | List of campaign IDs. Available for banner statistics. |
| campaign_id_ne | comma separated list of identifiers | & nbsp; | List of campaign IDs with negation. Available for banner statistics. |
| package_id | comma separated list of identifiers | & nbsp; | List of package identifiers. Available for banner statistics. |
| package_id_ne | comma separated list of identifiers | & nbsp; | Negated list of package ids. Available for campaign and banner statistics. |
| sort_by | field in the format metric.field_name | & nbsp; | Field by which identifiers of campaigns, banners or users will be sorted. Available metrics: base, events, video, carousel, tps, moat, playable, romi. |
| d | string field | asc | Sort direction. Available options: asc, desc |
| limit | integer from 1 to 250 | 20 | Number of objects to send. |
| offset | integer | 0 | Offset. |
The date_from parameter is required.
In one request, you can get both all statistical metrics and specific sets. & nbsp;
Response structure:
Request example:
GET {host}/api/v2/statistics/goals/{banners|campaigns|users}/day.jsonRestrictions and filters are set using GET parameters:
| Parameter | Format | Description |
| date_from | YYYY-MM-DD | Start date; |
| date_to | YYYY-MM-DD | End date (inclusive) |
| id | comma-separated list of IDs | A list of the IDs of the banners or campaigns |
| attribution | impression | To attribute at the time of the event, time of show |
| conversion_type | postview; postclick; total; or combinations of them, separated by commas | Conversion type: postclick, postview, total |
All parameters are required.
The structure of the response:
Example request:
GET {host}/api/v2/statistics/inapp/{banners|campaigns|users}/day.jsonThe resource returns statistics on mobile app events attributed to VK Ads ad impressions for campaigns and banners in a resolution of 1 day.
Restrictions and filters are set using GET parameters:
| Parameter | Format | Description |
| date_from | YYYY-MM-DD | Start date; |
| date_to | YYYY-MM-DD | End date (inclusive) |
| id | comma-separated list of IDs | A list of the IDs of the banners or campaigns |
| attribution | impression | To attribute at the time of the event, time of show |
| conversion_type | postview; postclick; total; or combinations of them, separated by commas | Conversion type: postclick, postview, total |
All parameters are required.
The structure of the response:
Example request:
The resource returns statistics on events attributed to VK Ads ad impressions from the lists of offline conversions for campaigns in the resolution of 1 day.
GET api/v2/statistics/offline_conversions/campaigns/day.json
| Parameter | Format | Description |
| date_from | YYYY-MM-DD | Start date; |
| date_to | YYYY-MM-DD | End date (inclusive) |
| id | comma-separated list of IDs | List of campaign IDs |
Date filters take into account the date of the event that the conversion is attributed to
Response parameters:
"rate" conversion rate = users who were converted and saw the ad/ all users who saw the ad
in percentage
"cost" actual cost of attraction = the cost of the campaign/ users who were converted and saw the ad
"offline" = number of conversions
GET {host}/api/v2/statistics/{faststat|uniquestat}/{banners|campaigns|users}.jsonThe resource returns basic statistics for advertising objects in real time, without filtering incorrect traffic. The values in the final statistics may differ significantly.
Request uniquestat returns information about the unique coverage and its growth, but it works longer than faststat. Don't use uniquestat if you don't need information about unique coverage.
Restrictions and filters are set using GET parameters:
| Parameter | Format | Description |
| id | comma-separated list of IDs | A list of the IDs of the banners or campaigns |
All parameters are required.
The structure of the response:
Example request: