Statistics tree
Returns a list of available levels and parameters for each statistics level, which can be used for building a report.
Request format
https://partner.yandex.ru/api/statistics2/tree
? lang=<string>
& [pretty=<integer>]
& [stat_type=<string>]
-
- lang *
- Response language. Required in all requests.
-
- pretty
- Formats the results for readability. Allowed value :
pretty=1.
-
- 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.
* 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
{
"result" : {string},
"data" : {
"tree" : [
{
"title" : {string},
"id" : {string},
"conflict_fields" : [],
"dimension_fields" : [
{
"values" : [
[
{string},
{string}
],
[
...
]
],
"type" : {string},
"title" : {string},
"id" : {string}
},
{
"values" : [
[
{string},
{string}
],
[
...
]
],
"type" : {string},
"title" : {string},
"id" : {string}
}
],
"entity_fields" : [
{
"type" : {string},
"label" : {string},
"index" : {integer},
"id" : {string}
}
],
"entity_filter_fields" : {
"filter_field_name" : {
"type" : {string},
"index" : {integer}
}
},
"entity_filter_simple_fields" : [
[
{
"name" : {string},
"label" : {string},
"index" : {integer}
}
]
],
"fields" : [
{
"type" : {string},
"title" : {string},
"index" : {integer},
"id" : {string},
"category_name" : {string},
"category" : {integer}
}
],
"has_product" : "",
"has_raw_stat" : ""
}
]
}
}
Response parameters
-
- result
- The result of executing the method. Allowed values :
ok: Method call was successful.error: An error occurred when calling the method.
-
- data
- Response body.
-
- tree
- Statistics tree.
-
- title
- Name of the statistics level.
-
- id
- ID of the statistics level. This parameter is used in the request for building the report.
-
- conflict_fields
- Internal parameter. Not used.
-
- dimension_fields
- Information about fields that data will be grouped by in the report. For example, grouping by days or by weeks.
-
- id
- Field ID. This parameter is used in the request for building the report.
-
- title
- Name of the field.
-
- type
- The type of field (here, the field type is
select, representing a selection from the list of periods). This parameter is used for generating the page in the Partner Interface.
-
- values
- The list of possible periods. One of the values is used in the request for building the report.
-
-
- entity_fields
- Information about fields that data will be grouped by in the report. For example, grouping by username.
-
- id
- Field ID. This parameter is used in the request for building the report.
-
- label
- Name of the field. This parameter is used for generating the page in the Partner Interface.
-
- type
- The type of field (for example,
textmeans that the field supports text input). This parameter is used for generating the page in the Partner Interface.
-
- index
- Index.
-
-
- entity_filter_fields
- Information about fields that function as filters when building the report. SQL operators are applied to filters. For example, you can filter by platform ID. For more information, see Filter fields.
-
- filter_field_name
-
Name of the field that acts as a filter. This object contains the field's characteristics.
type: Field type. Helps determine which SQL operators can be applied to the filter. For more information, see Filter fields.index: Index.
-
-
- entity_filter_simple_fields
- Information about fields that function as filters when building the report.
-
- name
- Name of the field.
-
- label
- Name of the field. This parameter is used for generating the page in the Partner Interface.
-
- index
- Index.
-
-
- fields
- Information about fields that can be included in the report. For example, these fields can be various metrics like ad impressions in ad units or the turnover for RTB units.
-
- id
- Field ID. This parameter is used in the request for building the report.
-
- type
- The type of field (for example,
textmeans that the field supports text input). This parameter is used for generating the page in the Partner Interface.
-
- title
- Name of the field. This parameter is used for generating the page in the Partner Interface.
-
- index
- Index.
-
- category_name
- Internal parameter. Not used.
-
- category
- Internal parameter. Not used.
-
-
- has_product
- Internal parameter. Not used.
-
- has_raw_stat
- Internal parameter. Not used.
-
-
Example for JSON
Request:
curl -i -X GET 'https://partner.yandex.ru/api/statistics2/tree.json?lang=ru' \ -H 'Authorization : OAuth 123qwe456a...'
Response:
HTTP/1.1 200 OK Server : nginx Date : Fri, 02 Jul 2020 10:20:13 GMT Content-Type : application/json; charset=UTF-8 Transfer-Encoding : chunked Connection : keep-alive { "data" : { "tree" : [ { "conflict_fields" : [], "dimension_fields" : [ { "id" : "date", "title" : "Date", "type" : "select", "values" : [ [ "month",
@@ -233,14 +229,13 @@
], [ "year", "by year" ] ] }, { "id" : "geo", "title" : "Geography", "type" : "select", "values" : [ [ "country",
@@ -254,123 +249,108 @@
"area", "by region" ] ] } ], "entity_fields" : [ { "category" : 14, "category_name" : "Product", "id" : "block_level", "index" : 4, "label" : "Product's ad unit level", "type" : "tree" }, { "category" : 14, "category_name" : "Product", "id" : "page_level", "index" : 5, "label" : "Product level", "type" : "tree" }, { "category" : 12, "category_name" : "Platform", "id" : "page_id", "index" : 11, "label" : "Page ID", "type" : "publicid" }, { "category" : 12, "category_name" : "Platform", "id" : "page_caption", "index" : 12, "label" : "Page name", "type" : "text" }, { "category" : 10, "category_name" : "Ad unit", "id" : "complex_block_id", "index" : 14, "label" : "Ad unit ID", "type" : "publicid" }, { "category" : 10, "category_name" : "Ad unit", "id" : "block_caption", "index" : 15, "label" : "Ad unit name", "type" : "text" }, { "category" : 10, "category_name" : "Ad unit", "id" : "tag_id", "index" : 16, "label" : "Cross section ID", "type" : "publicid" }, { "category" : 9, "category_name" : "ADFOX", "id" : "adfox_block", "index" : 17, "label" : "ADFOX unit", "type" : "boolean" }, { "category" : 9, "category_name" : "ADFOX", "id" : "deal_id", "index" : 18, "label" : "Transaction ID", "type" : "publicid" }, { "category" : 9, "category_name" : "ADFOX", "id" : "deal_caption", "index" : 19, "label" : "Transaction name", "type" : "text" }, { "id" : "business_rule_id", "index" : 20, "label" : "Rule ID", "type" : "publicid" }, { "id" : "business_rule_title", "index" : 21, "label" : "Rule name", "type" : "text" }, { "category" : 7, "category_name" : "Traffic", "id" : "os", "index" : 22, "label" : "Operating system", "type" : "publicid" }, { "category" : 7, "category_name" : "Traffic", "id" : "browser", "index" : 23, "label" : "Browser", "type" : "publicid" },... { "category" : 6, "category_name" : "Recommendation metrics", "id" : "RecommendationWidgetCTR", "index" : 58, "title" : "Recommendation widget CTR", "type" : "text" @@ -385,15 +365,15 @@ }, "result" : "ok" }
Response language. Required in all requests.
Formats the results for readability. Allowed value : pretty=1.
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.
Required parameter.