Getting data by time
Used to get data broken down by time period (for example, by day, week, or month). Use this request type to create charts and track statistics over time. See an example with this request.
Request
GET
https://api-metrica.yandex.net/stat/v1/data/bytime
Query parameters
Name |
Description |
ids* |
Type: integer<int32>[] Comma-separated list of tag IDs. |
metrics* |
Type: string Comma-separated list of metrics.
Limit: 20 metrics per request. |
accuracy |
Type: string Sample size for the report. Use it to control the sampling rate (the number of sessions used for calculating results). |
annotation_groups |
Type: string
Groups of comma-separated comments to return in the response.
Passed if the parameter If the parameter A: Group A. B: Group B. C: Group C. D: Group D. E: Group E. HOLIDAY: Public holidays. Shown when Yandex Metrica could detect the tag's region. Enum: |
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: Default: |
date2 |
Type: string End date of the sample period in YYYY-MM-DD format. You can also use the values: Default: |
dimensions |
Type: string Comma-separated list of dimensions.
Limit: 10 dimensions per request. |
direct_client_logins |
Type: string[] Comma-separated usernames of Yandex Direct clients. They can be used for generating the Yandex Direct — costs report. |
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. |
group |
Type: string Grouping data by time:
Default: Enum: |
include_annotations |
Type: string Used to include comments in the response. Disabled by default. Default: |
include_undefined |
Type: boolean Outputs rows that don't have defined dimension values. This only affects the first dimension. Disabled by default. |
keys_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 |
lang |
Type: string Language. |
preset |
Type: string Report presets. |
pretty |
Type: string Specifies the formatting for results. To use formatting, set the value to Default: |
proposed_accuracy |
Type: boolean If parameter is set to |
row_ids |
Type: string[][] Row selection for creating charts. Contains listing of key lists. |
timezone |
Type: string Time zone in ±hh:mm format within the range of [-23:59; +23:59] (the plus sign should be denoted as |
top_keys |
Type: string Sets the number of rows of results if you don't set the parameter Default: Min value: |
Responses
200 OK
OK
Body
application/json
{
"query": {
"timezone": "string",
"preset": "string",
"dimensions": [
"string"
],
"metrics": [
"string"
],
"sort": [
"string"
],
"date1": "string",
"date2": "string",
"filters": "string"
},
"data": [
{
"dimensions": [
"string"
],
"metrics": [
[
0
]
]
}
],
"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": [
[
0
]
],
"annotations": [
[
{
"id": 0,
"date": "string",
"time": "string",
"title": "string",
"message": "string",
"group": "A"
}
]
]
}
Name |
Description |
annotations |
Type: MetrikaReportChartAnnotation[][] Comments. |
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 |
data |
Type: DynamicRow[] 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: DynamicQueryExternal 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: |
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: number<double>[][] Total results for metrics across the entire dataset (with filtration). |
MetrikaReportChartAnnotation
Name |
Description |
date |
Type: string<date> Date. |
group |
Type: string Group: A: Group A. B: Group B. C: Group C. D: Group D. E: Group E. HOLIDAY: Public holidays. Shown when Yandex Metrica could detect the tag's region. Enum: |
id |
Type: integer<int32> Comment ID. |
message |
Type: string Description. |
time |
Type: string<time> Time. |
title |
Type: string Title. |
DynamicRow
Response rows. An array in which each item is a single row of the result.
Name |
Description |
dimensions |
Type: string[] Array of dimension values for this row. Each dimension value is an object. It must have the |
metrics |
Type: number<double>[][] Array of arrays of metric values for this row. The outer array lists metrics, and the inner arrays list values of a specific metric for each time group. |
DynamicQueryExternal
Original request. Contains the request parameters, including detailed parameters from the template and parameters for attribute parametrization.
Name |
Description |
date1 |
Type: string Start date of the sample period in YYYY-MM-DD format. |
date2 |
Type: string End date of the sample period in YYYY-MM-DD format. |
dimensions |
Type: string[] Array of dimensions. |
filters |
Type: string Segmentation filter. |
metrics |
Type: string[] Array of metrics. |
preset |
Type: string Report preset. |
sort |
Type: string[] Array of sortings. |
timezone |
Type: string Time zone of the sample period in ±hh:mm format. |
No longer supported, please use an alternative and newer version.