Get data by time

Enables you to get data broken down by time period (such as by day, week, or month). Use this type of request to build charts and track statistics over time.

Request

GET

https://api.appmetrica.yandex.net/stat/v1/data/bytime

Query parameters

Name

Description

params

Type: BytimeParams

Example: ``

statGroupParams

Type: StatGroupParams

Example: ``

BytimeParams

Name

Description

access_filter_id

Type: integer

accuracy

Type: string

Example: example

annotation_groups

Type: string[]

Example
[
  "example"
]

callback

Type: string

Example: example

confidence_level

Type: string

Default: 0.95

date_dimension

Type: string

Example: example

date1

Type: string

Default: 6daysAgo

date2

Type: string

Default: today

dimensions

Type: string

Example: example

direct_client_ids

Type: integer[]

Example
[
  0
]

direct_client_logins

Type: string[]

Example
[
  "example"
]

exclude_insignificant

Type: boolean

filters

Type: string

Example: example

group

Type: string

Группировка данных по времени:

  • all — временной интервал не разбивается;
  • auto — интервал устанавливается с учетом выбранного отчетного периода и количества данных, достаточного для этого периода;
  • minutes — временной интервал разбивается на интервалы из некоторого количества минут. Возможные интервалы minutes: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440. Расчеты оптимизированы так, чтобы между точками на графике не было больше одного интервала, с лимитом в 1600 точек для минут;
  • dekaminute — временной интервал разбивается на 10-минутные интервалы;
  • minute — временной интервал разбивается на минутные интервалы;
  • hour — временной интервал разбивается на часовые интервалы;
  • hours — временной интервал разбивается на интервалы из нескольких часов. Возможные интервалы hours: 1, 2, 3, 4, 6, 8, 12, 24. Расчеты оптимизированы так, чтобы между точками на графике не было больше одного интервала, с лимитом в 30 точек для часов;
  • day — временной интервал разбивается по дням;
  • week — временной интервал разбивается по неделям;
  • month — временной интервал разбивается по месяцам;
  • quarter — временной интервал разбивается по кварталам;
  • year — временной интервал разбивается по годам.

Default: week

ids

Type: integer[]

Example
[
  0
]

include_annotations

Type: string

Default: false

include_meta

Type: boolean

include_undefined

Type: boolean

keys_sort

Type: string

Example: example

lang

Type: string

Example: example

max_deviation

Type: string

Default: 0.1

metrics

Type: string

Example: example

preset

Type: string

Example: example

pretty

Type: string

Default: false

proposed_accuracy

Type: boolean

reference_row_id

Type: string[]

Example
[
  "example"
]

request_domain

Type: string

Example: example

require_metric_values

Type: string

Default: false

row_ids

Type: string[][]

Example
[
  [
    "example"
  ]
]

timezone

Type: string

Example: example

top_keys

Type: string

Default: 7

with_confidence

Type: boolean

Example
{
  "ids": [
    0
  ],
  "direct_client_ids": [
    0
  ],
  "direct_client_logins": [
    "example"
  ],
  "date1": "6daysAgo",
  "date2": "today",
  "timezone": "example",
  "preset": "example",
  "metrics": "example",
  "dimensions": "example",
  "reference_row_id": [
    "example"
  ],
  "filters": "example",
  "accuracy": "example",
  "proposed_accuracy": true,
  "include_undefined": true,
  "include_meta": true,
  "with_confidence": true,
  "exclude_insignificant": true,
  "confidence_level": "0.95",
  "max_deviation": "0.1",
  "pretty": "false",
  "lang": "example",
  "request_domain": "example",
  "require_metric_values": "false",
  "access_filter_id": 0,
  "group": "week",
  "callback": "example",
  "date_dimension": "example",
  "row_ids": [
    [
      "example"
    ]
  ],
  "top_keys": "7",
  "keys_sort": "example",
  "include_annotations": "false",
  "annotation_groups": [
    "example"
  ]
}

StatGroupParams

Name

Description

label_id

Type: integer

Min value: 1

org_id

Type: integer

Min value: 1

Example
{
  "org_id": 1,
  "label_id": 1
}

Responses

200 OK

OK

Body

application/json
{
  "query": {
    "timezone": "example",
    "preset": "example",
    "dimensions": [
      "example"
    ],
    "metrics": [
      "example"
    ],
    "sort": [
      "example"
    ],
    "date1": "example",
    "date2": "example",
    "filters": "example"
  },
  "data": [
    {
      "dimensions": [
        {}
      ],
      "metrics": [
        [
          0.5
        ]
      ]
    }
  ],
  "total_rows": 0,
  "total_rows_rounded": true,
  "sampled": true,
  "contains_sensitive_data": true,
  "sample_share": 0.5,
  "sample_size": 0,
  "sample_space": 0,
  "data_lag": 0,
  "totals": [
    [
      0.5
    ]
  ],
  "annotations": [
    [
      {
        "id": 0,
        "date": "2025-01-01",
        "time": "12:00:00",
        "title": "example",
        "message": "example",
        "group": "example"
      }
    ]
  ]
}

Name

Description

annotations

Type: ConstructorReportChartAnnotation[][]

Comments.

Example
[
  [
    {
      "id": 0,
      "date": "2025-01-01",
      "time": "12:00:00",
      "title": "example",
      "message": "example",
      "group": "example"
    }
  ]
]

contains_sensitive_data

Type: boolean

Indicates whether sensitive data can be omitted from the response. Such data 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: DynamicRow[]

Example
[
  {
    "dimensions": [
      {}
    ],
    "metrics": [
      [
        0.5
      ]
    ]
  }
]

data_lag

Type: integer

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.

Example
{
  "timezone": "example",
  "preset": "example",
  "dimensions": [
    "example"
  ],
  "metrics": [
    "example"
  ],
  "sort": [
    "example"
  ],
  "date1": "example",
  "date2": "example",
  "filters": "example"
}

sample_share

Type: number

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

sample_size

Type: integer

Number of rows in the requested data.

sample_space

Type: integer

Number of data rows.

sampled

Type: boolean

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

total_rows

Type: integer

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[][]

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

Example
[
  [
    0.5
  ]
]

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 report period in the format YYYY-MM-DD.

Example: example

date2

Type: string

End date of the report period in the format YYYY-MM-DD.

Example: example

dimensions

Type: string[]

Example
[
  "example"
]

filters

Type: string

Segmentation filter.

Example: example

metrics

Type: string[]

Example
[
  "example"
]

preset

Type: string

Report preset.

Example: example

sort

Type: string[]

Example
[
  "example"
]

timezone

Type: string

The time zone of the selection period in the format ±hh:mm.

Example: example

Example
{
  "timezone": "example",
  "preset": "example",
  "dimensions": [
    "example"
  ],
  "metrics": [
    "example"
  ],
  "sort": [
    "example"
  ],
  "date1": "example",
  "date2": "example",
  "filters": "example"
}

DynamicRow

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

Name

Description

dimensions

Type: object[]

[additional]

Type: string

Example: example

Array of dimension values for this row. Each dimension value is an object. It must have the name field, which is a text value. But it can also have additional fields, such as id.

Example
[
  {}
]

metrics

Type: number[][]

Array of arrays of metric values for this row. The outer array lists metrics, whereas the inner arrays list values of a specific metric for each time group.

Example
[
  [
    0.5
  ]
]
Example
{
  "dimensions": [
    {}
  ],
  "metrics": [
    [
      0.5
    ]
  ]
}

ConstructorReportChartAnnotation

Name

Description

date

Type: string<date>

Date.

Example: 2025-01-01

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 successfully detected the tag's region.

Example: example

id

Type: integer

Comment ID.

message

Type: string

Description.

Example: example

time

Type: string<time>

Time.

Example: 12:00:00

title

Type: string

Title.

Example: example

Example
{
  "id": 0,
  "date": "2025-01-01",
  "time": "12:00:00",
  "title": "example",
  "message": "example",
  "group": "example"
}
上一篇
下一篇