获取按时间排序的数据

让您按时间段(例如按天、周或月)获取数据。 使用这种请求类型来绘制图表并跟踪随时间变化的统计数据。

Request

GET

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

Query parameters

Name

Description

params

Type: object

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: ``

statGroupParams

Type: object

label_id

Type: integer

Min value: 1

org_id

Type: integer

Min value: 1

Example: ``

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

date

Type: string<date>

Date.

Example: 2025-01-01

group

Type: string

Group:

  • A: 组A。
  • B: 组B。
  • C: 组C。
  • D: 组D。
  • E: 组E。
  • 假日:公共假日。 当Yandex Metrica成功检测到标签的区域时显示。

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

Comments.

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

contains_sensitive_data

Type: boolean

表示是否可以从响应中省略敏感数据。 这些数据包括由 Yandex 算法计算出的数据:人口统计数据(性别、年龄等)、登录页地址、搜索词语以及机器人信息。 如果值是true,当样本少于10个用户时,响应不会显示这些数据。 Possible values: 真, 假.

data

Type: object[]

dimensions

Type: object[]

[additional]

Type: string

Example: example

该行的维度值数组。 每个维度值都是一个对象。 它必须有名称字段,该字段为文本值。 但它还可能有额外的字段,例如id.

Example
[
  {}
]

metrics

Type: number[][]

该行的度量值数组数组。 外部数组列出指标,而内部数组列出每个时间组中特定指标的值。

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

data_lag

Type: integer

数据更新延迟,以秒为单位。

query

Type: object

date1

Type: string

报告期的开始日期,格式为 YYYY-MM-DD。

Example: example

date2

Type: string

报告期末日期,格式为YYYY-MM-DD。

Example: example

dimensions

Type: string[]

Example
[
  "example"
]

filters

Type: string

分段过滤器。

Example: example

metrics

Type: string[]

Example
[
  "example"
]

preset

Type: string

报告预设。

Example: example

sort

Type: string[]

Example
[
  "example"
]

timezone

Type: string

选择期间的时区,格式为 ±hh:mm。

Example: example

Original request. 包含请求参数,包括模板中的详细参数和属性参数化的参数。

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

sample_share

Type: number

用于计算的数据百分比。 可用的值范围是 0 到 1。

sample_size

Type: integer

请求数据中的行数。

sample_space

Type: integer

数据行数。

sampled

Type: boolean

Sampling flag. 表示是否应用了采样。 Possible values: 真, 假.

total_rows

Type: integer

响应中整个数据集(过滤后)的总行数。

total_rows_rounded

Type: boolean

表示总行数已被四舍五入。

totals

Type: number[][]

整个数据集(经过过滤)的指标总结果。

Example
[
  [
    0.5
  ]
]
上一篇
下一篇