Statistics report

Generates a report for the selected statistics level for the specified period.

Request format

https://partner.yandex.ru/api/statistics2/get
 ? lang=<string>
 & [pretty=<integer>]
 & [period=<string>]
 & [field=<string>]
 & [limits=<string>]
 & [dimension_field=<string|string>]
 & [entity_field=<string>]
 & [filter=<string>]
 & [order_by=<string>]
 & [vat=<boolean>]
 & [stat_type=<string>]
 & [currency=<string>]
 & [timezone=<string>]

Note

You can get statistics for any time period. To do this, enter two dates (the beginning and end of the period):

period=2014-06-29&period=2014-07-28
  • lang *
    Response language. Required in all requests.
  • pretty
    Formats the results for readability. Allowed value: pretty=1.
  • period *

    The time period to get a report for. Acceptable values:

    • today: Statistics for today.
    • yesterday: Statistics for yesterday.
    • thismonth: Statistics for the current month.
    • lastmonth: Statistics for the previous month.
    • 30days: Statistics for the last 30 days (including the current day).
    • 90days: Statistics for the last 90 days (including the current day).
    • 180days: Statistics for the last 180 days (including the current day).
    • 365days: Statistics for the last 365 days (including the current day).
    • thisyear: Statistics for the current year (including the current day).

    Note

    You can get statistics for any time period. To do this, enter two dates (the beginning and end of the period):

    period=2014-06-29&period=2014-07-28
    
  • field *

    Identifier of a field to include in the report. These are usually various indicators, such as ad impressions in blocks or ad requests in blocks. To get a list of such fields, see the fields structure for the Statistics tree resource.

    Note

    To add multiple fields to the report, specify the parameter multiple times:

    field=shows&field=hits
    
  • limits

    Pagination. Format:

    {"limit":50,"offset":0}
    
  • dimension_field
    ID of the field to be used for grouping (for example, grouping by day or by week). To get a list of such fields, see the dimension_fields structure for the Statistics tree resource.
  • entity_field

    ID of the field that will be used for grouping by the values of this field in the report (for example, the site domain and name). To get a list of such fields, see the entity_fields structure, Statistics tree resource.

    Note

    To group by multiple fields, specify the field IDs as follows:

    entity_field=domain&entity_field=page_id
    
  • filter
    Filter for building a report. As parameters, the filter uses the fields from the entity_filter_fields structure, Statistics tree resource. For more information, see Filter fields.
  • order_by

    Sorting the results. Format:

    [{"field":"date","dir":"asc"}]
    

    For the field parameter value, you can add the ID of the field to be used for grouping (a list of such fields is output in the dimension_fields structure for the Statistics tree resource). As the dir parameter value, you can use asc/desc to sort values in ascending/descending order.

  • vat
    Include or exclude VAT.
  • stat_type

    Report type. Acceptable values:

    • stat_type=mm: Mobile Mediation report.
    • stat_type=dsp: DSP report.
    • stat_type=ssp: SSP report.
    • stat_type=main: Report on basic statistics. Default value.
  • currency

    Report currency. Acceptable values:

    • USD: US dollars.
    • EUR: Euro.
    • RUB: Rubles. Default value.
  • timezone

    Additional parameter for retrieving statistics in the specified time zone.

    By default, statistics are based on Moscow time (Europe/Moscow, UTC+03:00).

    Note

    When requesting statistics broken down by day, the day boundaries will be based on your specified time zone.

    For example, passing the Asia/Bishkek time zone (UTC+06:00) shifts the start and end of the day by +3 hours relative to Moscow time (Europe/Moscow, UTC+03:00) — this will be accounted for in the statistics.

    Example:

    {
      "timezone": "Asia/Bishkek"
    }
    
    Supported timezone values
    UTC timezone value
    UTC-11:00 Pacific/Midway
    UTC-10:00 Pacific/Honolulu
    UTC-09:00 Pacific/Gambier
    UTC-09:30 Pacific/Marquesas
    UTC-08:00 Pacific/Pitcairn
    UTC-07:00 America/Creston
    UTC-06:00 America/Bahia_Banderas
    UTC-05:00 America/Bogota
    UTC-04:00 America/Anguilla
    UTC-03:00 America/Araguaina
    UTC-03:30 America/St_Johns
    UTC-02:00 America/Noronha
    UTC-01:00 Atlantic/Azores
    UTC±00:00 America/Danmarkshavn
    UTC+01:00 Africa/Tunis
    UTC+02:00 Europe/Kaliningrad
    UTC+03:00 Europe/Moscow
    UTC+03:30 Asia/Tehran
    UTC+04:00 Europe/Astrakhan
    UTC+04:30 Asia/Kabul
    UTC+05:00 Asia/Aqtau
    UTC+05:30 Asia/Calcutta
    UTC+05:45 Asia/Katmandu
    UTC+06:00 Asia/Bishkek
    UTC+06:30 Asia/Rangoon
    UTC+07:00 Asia/Bangkok
    UTC+08:00 Asia/Brunei
    UTC+08:45 Australia/Eucla
    UTC+09:00 Asia/Chita
    UTC+09:30 Australia/Darwin
    UTC+10:00 Asia/Ust-Nera
    UTC+10:30 Australia/Adelaide
    UTC+11:00 Asia/Magadan
    UTC+12:00 Asia/Anadyr
    UTC+13:00 Pacific/Apia
    UTC+13:45 Pacific/Chatham
    UTC+14:00 Pacific/Kiritimati

* Required parameter.

Request headers

Header Description Required
Authorization User access token. Yes

The general response structure is given below. The order of elements is not guaranteed.

Format of a JSON response

{
   "data" : {
      "currencies" : [
         {
            "code" : {string},
            "id" : {string}
         },
         {
            ...
         }
      ],
      "dimensions" : {
         "field_name" : {string}
      },
      "is_last_page" : {boolean},
      "measures" : {
         "field_name" : {string}
         
      },
      "periods" : [
         [
            {string},
            {string}
         ]
      ],
      "points" : [
         {
            "dimensions" : {
               "field_name" : {string}
            },
            "measures" : [
               {
                  ...
               }
            ]
         }
      ],
      "report_title" : {string},
      "totals" : {
         "2" : [
            {
               ...
            }
         ]
      }
   },
   "result" : {string}
}      

Response parameters

  • data
    Statistics tree.
    • currencies
      Currency description.
      • code
        Currency code.
      • id
        Currency ID.
    • totals
      Objects with summary data in the report. Each object contains a field with the currency ID and a list of values, such as the number of clicks and impressions.
    • is_last_page
      Indicates whether the current page is the last one (used for pagination). Acceptable values:
      • false: The page isn't the last one.
      • true: The page is the last one.
    • points
      Array of objects with data.
      • measures
        Fields listed in the request.
      • dimensions
        Fields that the report is grouped by.
    • dimensions
      Description of the fields that the report is grouped by.
    • report_title
      Report name.
  • result
    The result of executing the method. Acceptable values:
    • ok: Method call was successful.
    • error: An error occurred when calling the method.

Example for JSON

Request:

curl -i -g -H 'Authorization: OAuth 123qwe456a...' \
-X GET 'https://partner.yandex.ru/api/statistics2/get.json? \
lang=ru \
&pretty=1 \
&dimension_field=date|day \
&period=thismonth \
&entity_field=page_level \
&field=shows \
&field=hits_render \
&field=hits \
&filter=["page_id","=","458472"] \
&field=fillrate' \

Response:

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 16 Dec 2020 10:40:13 GMT
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive

{
   "data" : {
      "currencies" : [
         {
            "code" : "USD",
            "id" : "1"
         },
         {
            "code" : "RUB",
            "id" : "2"
         },
         {
            "code" : "EUR",
            "id" : "3"
         }
      ],
      "dimensions" : {
         "date" : {
            "index" : 1,
            "title" : "Date",
            "type" : "date"
         },
         "page_level" : {
            "index" : 2,
            "title" : "Product level",
            "type" : "categories"
         }
      },
      "is_last_page" : true,
      "measures" : {
         "fillrate" : {
            "index" : 6,
            "title" : "Fill rate of ad units accounting for viewability check",
            "type" : "percent",
            "unit" : "percent"
         },
         "hits" : {
            "index" : 5,
            "title" : "Ad requests in ad units",
            "type" : "number",
            "unit" : "count"
         },
         "hits_render" : {
            "index" : 4,
            "title" : "Ads rendered in ad units",
            "type" : "number",
            "unit" : "count"
         },
         "shows" : {
            "index" : 3,
            "title" : "Impressions in ad units",
            "type" : "number",
            "unit" : "count"
         }
      },
      "periods" : [
         [
            "2020-12-01",
            "2020-12-15"
         ]
      ],
      "points" : [
         {
            "dimensions" : {
               "date" : [
                  "2020-12-15"
               ],
               "page_level" : "Content platforms"
            },
            "measures" : [
               {
                  "fillrate" : 50,
                  "hits" : 2,
                  "hits_render" : 2,
                  "shows" : 1
               }
            ]
         },
         {
            "dimensions" : {
               "date" : [
                  "2020-12-02"
               ],
               "page_level" : "Content platforms"
            },
            "measures" : [
               {
                  "fillrate" : 0,
                  "hits" : 0,
                  "hits_render" : 0,
                  "shows" : 0
               }
            ]
         },
         {
            "dimensions" : {
               "date" : [
                  "2020-12-11"
               ],
               "page_level" : "Content platforms"
            },
            "measures" : [
               {
                  "fillrate" : 16.9291338582677,
                  "hits" : 254,
                  "hits_render" : 254,
                  "shows" : 43
               }
            ]
         },
         {
            "dimensions" : {
               "date" : [
                  "2020-12-14"
               ],
               "page_level" : "Content platforms"
            },
            "measures" : [
               {
                  "fillrate" : 0,
                  "hits" : 0,
                  "hits_render" : 0,
                  "shows" : 0
               }
            ]
         },
         {
            "dimensions" : {
               "date" : [
                  "2020-12-08"
               ],
               "page_level" : "Content platforms"
            },
            "measures" : [
               {
                  "fillrate" : 0,
                  "hits" : 0,
                  "hits_render" : 0,
                  "shows" : 0
               }
            ]
         }
      ],
      "report_title" : "Report for the period from 01.12.2020 to 15.12.2020",
      "total_rows" : 5,
      "totals" : {
         "2" : [
            {
               "fillrate" : 17.1875,
               "hits" : 256,
               "hits_render" : 256,
               "shows" : 44
            }
         ]

@@ -477,77 +463,78 @@

Response language. Required in all requests.

Formats the results for readability. Allowed value: pretty=1.

The time period to get a report for. Acceptable values:

  • today: Statistics for today.
  • yesterday: Statistics for yesterday.
  • thismonth: Statistics for the current month.
  • lastmonth: Statistics for the previous month.
  • 30days: Statistics for the last 30 days (including the current day).
  • 90days: Statistics for the last 90 days (including the current day).
  • 180days: Statistics for the last 180 days (including the current day).
  • 365days: Statistics for the last 365 days (including the current day).
  • thisyear: Statistics for the current year (including the current day).

Identifier of a field to include in the report. These are usually various indicators, such as ad impressions in blocks or ad requests in blocks. To get a list of such fields, see the fields structure for the Statistics tree resource.

Note

To add multiple fields to the report, specify the parameter multiple times:

field=shows&field=hits

Pagination. Format:

{"limit":50,"offset":0}

ID of the field to be used for grouping (for example, grouping by day or by week). To get a list of such fields, see the dimension_fields structure for the Statistics tree resource.

ID of the field that will be used for grouping by the values of this field in the report (for example, the site domain and name). To get a list of such fields, see the entity_fields structure, Statistics tree resource.

Note

To group by multiple fields, specify the field IDs as follows:

entity_field=domain&entity_field=page_id

Filter for building a report. As parameters, the filter uses the fields from the entity_filter_fields structure, Statistics tree resource. For more information, see Filter fields.

Sorting the results. Format:

[{"field":"date","dir":"asc"}]

For the field parameter value, you can add the ID of the field to be used for grouping (a list of such fields is output in the dimension_fields structure for the Statistics tree resource). As the dir parameter value, you can use asc/desc to sort values in ascending/descending order.

Include or exclude VAT.

Report type. Acceptable values:

  • stat_type=mm: Mobile Mediation report.
  • stat_type=dsp: DSP report.
  • stat_type=ssp: SSP report.
  • stat_type=main: Report on basic statistics. Default value.

Report currency. Acceptable values:

  • USD: US dollars
  • EUR: Euro.
  • RUB: Rubles Default value.

Required parameter.

Additional parameter for retrieving statistics in the specified time zone. By default, statistics are based on Moscow time (Europe/Moscow, UTC+03:00).