Comparison — drill down

You can use this method to combine the following methods: Drill down and Comparing segments. As a result, you can get data on tree branches for the comparison of segments.

For each value of a dimension, the API returns two sets of metrics For example, for segment A and segment B. You can set different date ranges and segmentation filters for each segment.

Request

GET

https://api-metrica.yandex.net/stat/v1/data/comparison/drilldown

Query parameters

Name

Description

ids*

Type: integer<int32>[]

Comma-separated list of tag IDs.
Example: 44147844,2215573

metrics*

Type: string

Comma-separated list of metrics. Limit: 20 metrics per request.
Example: ym:s:pageviews

accuracy

Type: string

Sample size for the report. Use it to control the sampling rate (the number of sessions used for calculating results).

callback

Type: string

Callback function that processes the API response.

date1

Type: string

Start date of the sample period in YYYY-MM-DD format. You can also use the values: today, yesterday, ndaysAgo.

Default: 6daysAgo

date1_a

Type: string

Start date of the sample period for segment A in YYYY-MM-DD format. You can also use the values: today, yesterday, ndaysAgo.

Default: 6daysAgo

date1_b

Type: string

Start date of the sample period for segment B in YYYY-MM-DD format. You can also use the values: today, yesterday, ndaysAgo.

Default: 6daysAgo

date2

Type: string

End date of the sample period in YYYY-MM-DD format. You can also use the values: today, yesterday, ndaysAgo.

Default: today

date2_a

Type: string

End date of the sample period for segment A in YYYY-MM-DD format. You can also use the values: today, yesterday, ndaysAgo.

Default: today

date2_b

Type: string

End date of the sample period for segment B in YYYY-MM-DD format. You can also use the values: today, yesterday, ndaysAgo.

Default: today

dimensions

Type: string

Comma-separated list of dimensions. Limit: 10 dimensions per request.
Example: ym:s:trafficSource

direct_client_logins

Type: string[]

Comma-separated usernames of Yandex Direct clients. They can be used for generating the Yandex Direct — costs report.
Example: login1,login2

filters

Type: string

Segmentation filter. Limits: up to 10 unique dimensions and metrics; up to 20 separate filters; up to 10,000 characters per filter row; and up to 100 values per filtering condition.

filters_a

Type: string

Segmentation filter for segment A.

filters_b

Type: string

Segmentation filter for segment A.

include_undefined

Type: boolean

Outputs rows that don't have defined dimension values. This only affects the first dimension. Disabled by default.

lang

Type: string

Language.

limit

Type: string

Number of items on the results page. Limit: 100,000.

Default: 100

Min value: 0

offset

Type: string

Index of the first row of requested data, starting from 1.

Default: 1

Min value: 1

only_expandable_undefined

Type: boolean

Deletes unexpanded, undefined values from results. Use only when include_undefined=true.

parent_id

Type: string[]

Row for expanding further. Consists of a JSON list of keys.

preset

Type: string

Report presets.
Example: sources_summary

pretty

Type: string

Specifies the formatting for results. To use formatting, set the value to true.

Default: false

proposed_accuracy

Type: boolean

If parameter is set to true, the API has the right to automatically increase accuracy to the recommended value. This parameter can help you obtain meaningful results when a request is sent to a small table with very small sampling.

sort

Type: string

Comma-separated list of dimensions and metrics to use for sorting. By default, data is sorted in descending order (indicated by the - symbol in front of the dimension or metric). To sort data in ascending order, remove the - symbol.

timezone

Type: string

Time zone in ±hh:mm format within the range of [-23:59; +23:59] (the plus sign should be denoted as %2B). This time zone is used when calculating the request sample period as well as the date- and time-specific dimensions. By default, the tag's time zone is used.
Example: -01:30, -01:00, -00:00, +00:00, +01:00, +01:30

Responses

200 OK

OK

Body

application/json
{
    "query": {
        "timezone": "string",
        "preset": "string",
        "dimensions": [
            "string"
        ],
        "metrics": [
            "string"
        ],
        "sort": [
            "string"
        ],
        "date1_a": "string",
        "date2_a": "string",
        "filters_a": "string",
        "date1_b": "string",
        "date2_b": "string",
        "filters_b": "string",
        "limit": 0,
        "offset": 0
    },
    "data": [
        {
            "dimension": [
                "string"
            ],
            "metrics": {
                "a": [
                    0
                ],
                "b": [
                    0
                ]
            },
            "expand": false
        }
    ],
    "total_rows": 0,
    "total_rows_rounded": false,
    "sampled": false,
    "contains_sensitive_data": false,
    "sample_share": 0,
    "sample_size": 0,
    "sample_space": 0,
    "data_lag": 0,
    "totals": {
        "a": [
            0
        ],
        "b": [
            0
        ]
    }
}

Name

Description

contains_sensitive_data

Type: boolean

Indicates whether sensitive data can be omitted from the response. This includes data calculated by Yandex algorithms: demographic data (gender, age, and other), login page addresses, search phrases, and robot information. If the value is true, the response will not display such data if the sample is less than 10 users. Possible values: true, false.

data

Type: ComparisonRowDrillDownAB[]

Response rows. An array in which each item is a single row of the result.

data_lag

Type: integer<int32>

Delay in updating data, in seconds.

query

Type: ComparisonQueryAB

Original request. Contains the request parameters, including detailed parameters from the template and parameters for attribute parametrization.

sample_share

Type: number<double>

Percentage of data used for the calculation. Available values range from 0 to 1.

sample_size

Type: integer<int64>

Number of rows in the requested data.

sample_space

Type: integer<int64>

Number of data rows.

sampled

Type: boolean

Sampling flag. Indicates whether sampling was applied. Possible values: true, false.

total_rows

Type: integer<int64>

The total number of rows in the response for the entire dataset (after filtering).

total_rows_rounded

Type: boolean

Indicates that the total number of rows was rounded.

totals

Type: ComparisonDataAB

Total results for metrics across the entire dataset (with filtration).

ComparisonRowDrillDownAB

Response rows. An array in which each item is a single row of the result.

Name

Description

dimension

Type: string[]

Dimension value for the specified level of the tree. For example, the second tree level is set (the parent_id array is one ID long). In this case, the field contains the value of the second dimension in the request.

expand

Type: boolean

Indicates whether to expand this row to the next level of the tree.

metrics

Type: ComparisonDataAB

Total results for metrics across the entire dataset (with filtration).

ComparisonQueryAB

Original request. Contains the request parameters, including detailed parameters from the template and parameters for attribute parametrization.

Name

Description

date1_a

Type: string

Start date of the sample period for segment A in YYYY-MM-DD format.

date1_b

Type: string

Start date of the sample period for segment B in YYYY-MM-DD format.

date2_a

Type: string

End date of the sample period for segment A in YYYY-MM-DD format.

date2_b

Type: string

End date of the sample period for segment B in YYYY-MM-DD format.

dimensions

Type: string[]

Array of dimensions.

filters_a

Type: string

Segmentation filter for segment A.

filters_b

Type: string

Segmentation filter for segment B.

limit

Type: integer<int32>

Number of items on the results page.

metrics

Type: string[]

Array of metrics.

offset

Type: integer<int32>

Index of the first row of requested data, starting from 1.

preset

Type: string

Report preset.

sort

Type: string[]

Array of sortings.

timezone

Type: string

Time zone of the sample period in ±hh:mm format.

ComparisonDataAB

Total results for metrics across the entire dataset (with filtration).

Name

Description

a

Type: number<double>[]

Array of metric values for segment A.

b

Type: number<double>[]

Array of metric values for segment B.