Drill down

Позволяет сформировать многоуровневый (древовидный) отчет. При этом каждому уровню соответствует одна группировка. Запрос к методу drilldown возвращает один подуровень для указанного родительского уровня. Родительский уровень указывается в параметре parent_id. Чтобы получить данные для первого уровня, отправьте запрос без параметра parent_id. Чтобы получить данные для вложенных уровней, необходимо указать путь от корня. Путь формируется из значений поля id параметра dimension. Если поле id отсутствует, укажите поле name. Посмотрите как используется данный запрос в примере.

Request

GET

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

Query parameters

Name

Description

ids

Type: integer[]

Идентификаторы счетчиков, через запятую.

Example: 44147844,2215573

metrics

Type: string

Список метрик, разделенных запятой. Лимит: 20 метрик в запросе.

Example: ym:s:pageviews

accuracy

Type: string

Размер выборки, используемой для отчета. Позволяет управлять семплированием (количеством визитов, использованных при расчете итогового значения).

Example: ``

callback

Type: string

Функция обратного вызова, которая обрабатывает ответ API.

Example: ``

date1

Type: string

Дата начала периода выборки в формате YYYY-MM-DD. Также используйте значения: today, yesterday, ndaysAgo.

Default: 6daysAgo

Example: ``

date2

Type: string

Дата окончания периода выборки в формате YYYY-MM-DD. Также используйте значения: today, yesterday, ndaysAgo.

Default: today

Example: ``

dimensions

Type: string

Список группировок, разделенных запятой. Лимит: 10 группировок в запросе.

Example: ym:s:trafficSource

direct_client_logins

Type: string[]

Логины клиентов Яндекс Директа, через запятую. Могут использоваться для формирования отчета Директ-расходы.

Example: login1,login2

filters

Type: string

Фильтр сегментации. Лимит: количество уникальных группировок и метрик — до 10, количество отдельных фильтров — до 20, длина строки в фильтре — до 10 000 символов; количество значений в одном условии фильтрации — 100.

Example: ``

include_undefined

Type: boolean

Включает в ответ строки, для которых значения группировок не определены. Влияет только на первую группировку. По умолчанию выключено.

lang

Type: string

Язык.

Example: ``

limit

Type: string

Количество элементов на странице выдачи. Лимит: 100 000.

Default: 100

Example: ``

offset

Type: string

Индекс первой строки выборки, начиная с 1.

Default: 1

Example: ``

only_expandable_undefined

Type: boolean

Удалять из результата нераскрывающиеся неопределённые значения. Имеет смысл только в случае include_undefined=true.

parent_id

Type: string[]

Выбор строки для дальнейшего развертывания. Состоит из json-списка ключей.

Example: ``

preset

Type: string

Шаблон отчета.

Example: sources_summary

pretty

Type: string

Задает форматирование результата. Чтобы использовать форматирование, укажите значение true.

Default: false

Example: ``

proposed_accuracy

Type: boolean

Если параметр выставлен в true, API имеет право автоматически увеличивать accuracy до рекомендованного значения.Когда идет запрос в маленькую таблицу с очень маленьким семплингом, параметр поможет получить осмысленные результаты.

sort

Type: string

Список группировок и метрик, разделенных запятой, по которым осуществляется сортировка. По умолчанию сортировка производится по убыванию (указан знак - перед группировкой или метрикой). Чтобы отсортировать данные по возрастанию, удалите знак -.

Example: ``

timezone

Type: string

Часовой пояс в формате ±hh:mm в диапазоне [-23:59; +23:59] (знак плюса нужно передавать как %2B), в котором будут рассчитан период выборки запроса, а также связанные с датой и временем группировки. По умолчанию используется часовой пояс счетчика.

Example: +03:00

Responses

200 OK

OK

Body

application/json
{
  "query": {
    "ids": [
      0
    ],
    "timezone": "example",
    "preset": "example",
    "dimensions": [
      "example"
    ],
    "metrics": [
      "example"
    ],
    "sort": [
      "example"
    ],
    "date1": "example",
    "date2": "example",
    "filters": "example",
    "limit": 0,
    "offset": 0
  },
  "data": [
    {
      "dimension": {},
      "metrics": [
        0.5
      ],
      "metrics_confidence_threshold": [
        0
      ],
      "metrics_confidence_flags": [
        true
      ],
      "expand": true,
      "extended_metrics": [
        {
          "value": 0.5,
          "error": 0.5,
          "coef_to_reference": 0.5
        }
      ]
    }
  ],
  "meta": {
    "dimensions": [
      {
        "id": "example",
        "dim": "example",
        "name": "example",
        "short_name": "example",
        "group_name": "example",
        "description": "example",
        "type": "example",
        "disallow_by_time": true,
        "allow_filters": true,
        "parameter": {
          "id": "example",
          "description": "example",
          "dim": "example"
        },
        "fields": {},
        "allow_sort": true,
        "default_sort": "example",
        "allow_null": true,
        "sub_table": "example",
        "permission_scope": "example",
        "since": "example",
        "advanced": true,
        "required_keys": [
          "example"
        ],
        "features": [
          "example"
        ],
        "chained_attributes_group_name": "example",
        "chained_attributes_group_index": 0,
        "secret": true,
        "exposes_secret_data": true,
        "disjoint": true,
        "relations": [
          "example"
        ]
      }
    ],
    "metrics": [
      {
        "dim": "example",
        "metric_string": "example",
        "name": "example",
        "description": "example",
        "allow_normalisation": true,
        "require_dynamic_correction": true,
        "allow_filters": true,
        "type": "example",
        "allow_sort": true,
        "default_sort": "example",
        "advanced": true,
        "support_confidence": true,
        "negative": true,
        "parameters": [
          null
        ],
        "sub_table": "example",
        "required_dimension": "example",
        "permission_scope": "example",
        "since": "example",
        "required_keys": [
          "example"
        ],
        "features": [
          "example"
        ],
        "secret": true,
        "exposes_secret_data": true
      }
    ]
  },
  "total_rows": 0,
  "total_rows_rounded": true,
  "with_confidence": true,
  "exclude_insignificant": true,
  "sampled": true,
  "sampleable": true,
  "contains_sensitive_data": true,
  "sample_share": 0.5,
  "max_sample_share": 0.5,
  "min_sample_share": 0.5,
  "sample_size": 0,
  "sample_space": 0,
  "data_lag": 0,
  "totals": [
    0.5
  ],
  "min": [
    0.5
  ],
  "max": [
    0.5
  ]
}

Name

Description

contains_sensitive_data

Type: boolean

Признак возможного отсутствия конфиденциальных данных в ответе. К ним относятся данные, которые рассчитываются алгоритмами Яндекса, например, социально-демографические (пол, возраст и др.), адреса страниц входа, поисковые фразы, информация о роботах. При значении true в ответе не отобразятся такие данные, если выборка составляет меньше 10 посетителей. Возможные значения: true, false.

data

Type: DrillDownRow[]

Example
[
  {
    "dimension": {},
    "metrics": [
      0.5
    ],
    "metrics_confidence_threshold": [
      0
    ],
    "metrics_confidence_flags": [
      true
    ],
    "expand": true,
    "extended_metrics": [
      {
        "value": 0.5,
        "error": 0.5,
        "coef_to_reference": 0.5
      }
    ]
  }
]

data_lag

Type: integer

Задержка в обновлении данных, в секундах.

max

Type: number[]

Example
[
  0.5
]

meta

Type: Meta

Метаданные запроса. Содержит описание группировок и метрик запроса.

Example
{
  "dimensions": [
    {
      "id": "example",
      "dim": "example",
      "name": "example",
      "short_name": "example",
      "group_name": "example",
      "description": "example",
      "type": "example",
      "disallow_by_time": true,
      "allow_filters": true,
      "parameter": {
        "id": "example",
        "description": "example",
        "dim": "example"
      },
      "fields": {},
      "allow_sort": true,
      "default_sort": "example",
      "allow_null": true,
      "sub_table": "example",
      "permission_scope": "example",
      "since": "example",
      "advanced": true,
      "required_keys": [
        "example"
      ],
      "features": [
        "example"
      ],
      "chained_attributes_group_name": "example",
      "chained_attributes_group_index": 0,
      "secret": true,
      "exposes_secret_data": true,
      "disjoint": true,
      "relations": [
        "example"
      ]
    }
  ],
  "metrics": [
    {
      "dim": "example",
      "metric_string": "example",
      "name": "example",
      "description": "example",
      "allow_normalisation": true,
      "require_dynamic_correction": true,
      "allow_filters": true,
      "type": "example",
      "allow_sort": true,
      "default_sort": "example",
      "advanced": true,
      "support_confidence": true,
      "negative": true,
      "parameters": [
        null
      ],
      "sub_table": "example",
      "required_dimension": "example",
      "permission_scope": "example",
      "since": "example",
      "required_keys": [
        "example"
      ],
      "features": [
        "example"
      ],
      "secret": true,
      "exposes_secret_data": true
    }
  ]
}

min

Type: number[]

Example
[
  0.5
]

query

Type: QueryExternal

Исходный запрос. Содержит параметры запроса, включая развернутые параметры из шаблона и параметры для схемы параметризации атрибутов.

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

sample_share

Type: number

Доля данных, по которым осуществлялся расчет. Доступно значение в пределах от 0 до 1.

sample_size

Type: integer

Количество строк в выборке данных.

sample_space

Type: integer

Количество строк данных.

sampled

Type: boolean

Признак семплирования. Показывает, был ли применен семплинг. Возможные значения: true, false.

total_rows

Type: integer

Общее количество строк в ответе по всему множеству данных (с учетом фильтра).

total_rows_rounded

Type: boolean

Признак того, что общее количество строк было округлено.

totals

Type: number[]

Example
[
  0.5
]

QueryExternal

Исходный запрос. Содержит параметры запроса, включая развернутые параметры из шаблона и параметры для схемы параметризации атрибутов.

Name

Description

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

limit

Type: integer

Количество элементов на странице выдачи.

metrics

Type: string[]

Example
[
  "example"
]

offset

Type: integer

Индекс первой строки выборки, начиная с 1.

preset

Type: string

Пресет отчета.

Example: example

sort

Type: string[]

Example
[
  "example"
]

timezone

Type: string

Часовой пояс периода выборки в формате ±hh:mm.

Example: example

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

DrillDownRow

Строки ответа. Представляет собой массив, каждый элемент которого — одна строка результата.

Name

Description

dimension

Type: object

[additional]

Type: string

Значение группировки для заданного уровня дерева. Например, задан второй уровень дерева (длина переданного массива parent_id равна единице). В данном случае поле будет содержать значение второй группировки запроса.

Example: example

Значение группировки для заданного уровня дерева. Например, задан второй уровень дерева (длина переданного массива parent_id равна единице). В данном случае поле будет содержать значение второй группировки запроса.

Example
{}

expand

Type: boolean

Указывает можно ли раскрыть эту строку на следующий уровень дерева.

metrics

Type: number[]

Example
[
  0.5
]
Example
{
  "dimension": {},
  "metrics": [
    0.5
  ],
  "expand": true
}

ParamMetaExternal

Список параметров метрики

Name

Description

description

Type: string

Описание параметра

Example: example

dim

Type: string

Имя измерения с значениями

Example: example

id

Type: string

Идентификатор параметра

Example: example

Example
{
  "id": "example",
  "description": "example",
  "dim": "example"
}

DimensionMetaExternal

Name

Description

advanced

Type: boolean

Группировка для опытного пользователя

allow_filters

Type: boolean

Возможно ли использование фильтров

allow_null

Type: boolean

Разрешается ли показывать для этой группировки "Не определено"

allow_sort

Type: boolean

Возможно ли сортировать по этой группировке

chained_attributes_group_index

Type: integer

Порядок группировки в группе связанных группировок

chained_attributes_group_name

Type: string

Имя группы связанных группировок

Example: example

default_sort

Type: string

Способ сортировки:

  • asc
  • desc

Example: example

description

Type: string

Описание метрики

Example: example

dim

Type: string

Группировка

Example: example

disallow_by_time

Type: boolean

Запрещено ли для этой группировки сочетание с группировкой по времени.

features

Type: string[]

Характеристики счетчика, необходимые для использования группировки

Unique items: true

Example
[
  "example"
]

fields

Type: object

[additional]

Type: DimensionMetaExternal

Example
{
  "id": "example",
  "dim": "example",
  "name": "example",
  "short_name": "example",
  "group_name": "example",
  "description": "example",
  "type": "example",
  "disallow_by_time": true,
  "allow_filters": true,
  "parameter": {
    "id": "example",
    "description": "example",
    "dim": "example"
  },
  "fields": {},
  "allow_sort": true,
  "default_sort": "example",
  "allow_null": true,
  "sub_table": "example",
  "permission_scope": "example",
  "since": "example",
  "advanced": true,
  "required_keys": [
    "example"
  ],
  "features": [
    "example"
  ],
  "chained_attributes_group_name": "example",
  "chained_attributes_group_index": 0,
  "secret": true,
  "exposes_secret_data": true,
  "disjoint": true,
  "relations": [
    "example"
  ]
}

Дополнительные поля для этой группировки

Example
{}

group_name

Type: string

Название группировки при перечислении

Example: example

id

Type: string

Идентификатор группировки без префикса и параметров

Example: example

name

Type: string

Название группировки

Example: example

parameter

Type: ParamMetaExternal

Список параметров метрики

Example
{
  "id": "example",
  "description": "example",
  "dim": "example"
}

permission_scope

Type: string

Группа доступа к группировке

Example: example

required_keys

Type: string[]

Example
[
  "example"
]

short_name

Type: string

Название группировки

Example: example

since

Type: string

Дата появления данных для группировки

Example: example

sub_table

Type: string

Подтаблица

Example: example

type

Type: string

Интерфейсный тип группировки

Example: example

Example
{
  "id": "example",
  "dim": "example",
  "name": "example",
  "short_name": "example",
  "group_name": "example",
  "description": "example",
  "type": "example",
  "disallow_by_time": true,
  "allow_filters": true,
  "parameter": {
    "id": "example",
    "description": "example",
    "dim": "example"
  },
  "fields": {},
  "allow_sort": true,
  "default_sort": "example",
  "allow_null": true,
  "sub_table": "example",
  "permission_scope": "example",
  "since": "example",
  "advanced": true,
  "required_keys": [
    "example"
  ],
  "features": [
    "example"
  ],
  "chained_attributes_group_name": "example",
  "chained_attributes_group_index": 0
}

MetricMetaExternal

Массив метаданных метрик запроса.

Name

Description

advanced

Type: boolean

Метрика для опытных пользователей

allow_filters

Type: boolean

Возможно ли использование фильтров

allow_normalisation

Type: boolean

Возможна ли нормализация значений

allow_sort

Type: boolean

Возможно ли сортировать по этой метрике

default_sort

Type: string

Способ сортировки:

  • asc
  • desc

Example: example

description

Type: string

Описание метрики

Example: example

dim

Type: string

Метрика

Example: example

exposes_secret_data

Type: boolean

Раскрывает секретные данные

features

Type: string[]

Характеристики счетчика, необходимые для использования метрики

Unique items: true

Example
[
  "example"
]

metric_string

Type: string

Метрика со значением параметра

Example: example

name

Type: string

Название метрики

Example: example

negative

Type: boolean

Является ли метрика отрицательным индикатором в контексте интерпретации данных, например: процент отказов, роботов и т.д.

parameters

Type: ParamMetaExternal[]

Список параметров метрики

Example
[
  {
    "id": "example",
    "description": "example",
    "dim": "example"
  }
]

permission_scope

Type: string

Группа доступа к метрике

Example: example

require_dynamic_correction

Type: boolean

Необходима ли корректировка значения в отчете по времени

required_dimension

Type: string

Необходимая для метрики группировка

Example: example

required_keys

Type: string[]

Example
[
  "example"
]

secret

Type: boolean

Содержит секретные данные

since

Type: string

Дата появления данных для метрики

Example: example

sub_table

Type: string

Подтаблица

Example: example

support_confidence

Type: boolean

Возможен ли расчет доверия для этой метрики

type

Type: string

Тип метрики.

  • int
  • double
  • second
  • millisecond
  • affinity
  • percents
  • currency

Example: example

Example
{
  "dim": "example",
  "metric_string": "example",
  "name": "example",
  "description": "example",
  "allow_normalisation": true,
  "require_dynamic_correction": true,
  "allow_filters": true,
  "type": "example",
  "allow_sort": true,
  "default_sort": "example",
  "advanced": true,
  "support_confidence": true,
  "negative": true,
  "parameters": [
    {
      "id": "example",
      "description": "example",
      "dim": "example"
    }
  ],
  "sub_table": "example",
  "required_dimension": "example",
  "permission_scope": "example",
  "since": "example",
  "required_keys": [
    "example"
  ],
  "features": [
    "example"
  ],
  "secret": true,
  "exposes_secret_data": true
}

Meta

Метаданные запроса. Содержит описание группировок и метрик запроса.

Name

Description

dimensions

Type: DimensionMetaExternal[]

Example
[
  {
    "id": "example",
    "dim": "example",
    "name": "example",
    "short_name": "example",
    "group_name": "example",
    "description": "example",
    "type": "example",
    "disallow_by_time": true,
    "allow_filters": true,
    "parameter": {
      "id": "example",
      "description": "example",
      "dim": "example"
    },
    "fields": {},
    "allow_sort": true,
    "default_sort": "example",
    "allow_null": true,
    "sub_table": "example",
    "permission_scope": "example",
    "since": "example",
    "advanced": true,
    "required_keys": [
      "example"
    ],
    "features": [
      "example"
    ],
    "chained_attributes_group_name": "example",
    "chained_attributes_group_index": 0,
    "secret": true,
    "exposes_secret_data": true,
    "disjoint": true,
    "relations": [
      "example"
    ]
  }
]

metrics

Type: MetricMetaExternal[]

Example
[
  {
    "dim": "example",
    "metric_string": "example",
    "name": "example",
    "description": "example",
    "allow_normalisation": true,
    "require_dynamic_correction": true,
    "allow_filters": true,
    "type": "example",
    "allow_sort": true,
    "default_sort": "example",
    "advanced": true,
    "support_confidence": true,
    "negative": true,
    "parameters": [
      {
        "id": "example",
        "description": "example",
        "dim": "example"
      }
    ],
    "sub_table": "example",
    "required_dimension": "example",
    "permission_scope": "example",
    "since": "example",
    "required_keys": [
      "example"
    ],
    "features": [
      "example"
    ],
    "secret": true,
    "exposes_secret_data": true
  }
]
Example
{
  "dimensions": [
    {
      "id": "example",
      "dim": "example",
      "name": "example",
      "short_name": "example",
      "group_name": "example",
      "description": "example",
      "type": "example",
      "disallow_by_time": true,
      "allow_filters": true,
      "parameter": {
        "id": "example",
        "description": "example",
        "dim": "example"
      },
      "fields": {},
      "allow_sort": true,
      "default_sort": "example",
      "allow_null": true,
      "sub_table": "example",
      "permission_scope": "example",
      "since": "example",
      "advanced": true,
      "required_keys": [
        "example"
      ],
      "features": [
        "example"
      ],
      "chained_attributes_group_name": "example",
      "chained_attributes_group_index": 0,
      "secret": true,
      "exposes_secret_data": true,
      "disjoint": true,
      "relations": [
        "example"
      ]
    }
  ],
  "metrics": [
    {
      "dim": "example",
      "metric_string": "example",
      "name": "example",
      "description": "example",
      "allow_normalisation": true,
      "require_dynamic_correction": true,
      "allow_filters": true,
      "type": "example",
      "allow_sort": true,
      "default_sort": "example",
      "advanced": true,
      "support_confidence": true,
      "negative": true,
      "parameters": [
        null
      ],
      "sub_table": "example",
      "required_dimension": "example",
      "permission_scope": "example",
      "since": "example",
      "required_keys": [
        "example"
      ],
      "features": [
        "example"
      ],
      "secret": true,
      "exposes_secret_data": true
    }
  ]
}

ExtendedMetrics

Name

Description

coef_to_reference

Type: number

error

Type: number

value

Type: number

Example
{
  "value": 0.5,
  "error": 0.5,
  "coef_to_reference": 0.5
}

No longer supported, please use an alternative and newer version.