Read Metrika: counters, goals, statistics
direct_metrikaRead Yandex Metrika data: list accessible counters, view goals, and request statistics slices with custom dimensions and metrics. End the date range yesterday to avoid underfilled current-day reports.
Instructions
The Yandex Metrika API, reading only. Three actions: 'counters' lists the counters this token can see; 'goals' lists one counter's goals; 'stat' answers one statistics slice ā dimensions and metrics travel to the API as the ym:* names you write, and accuracy=full is sewn in because the service default is SAMPLING, on which a rare conversion rounds to zero while the report looks ordinary.
š“ Data arrives with a lag of about 2 hours: the current day is underfilled, and judging it has produced wrong conclusions twice in a row. End the window yesterday.
Needs its own credential, not the Direct one: python -m shturman_direct login metrika. Creating goals is a write and lives in direct_metrika_goals.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date1 | No | YYYY-MM-DD. stat only, required there ā explicit on purpose | |
| date2 | No | YYYY-MM-DD. stat only, required there. Make it yesterday: the current day is underfilled by about 2 hours | |
| limit | No | rows to return, default 200 | |
| action | Yes | counters: what the token sees; goals: one counter's goals; stat: one statistics slice | |
| counter | No | numeric counter id. Required for goals and stat | |
| filters | No | Metrika filter expression, optional | |
| metrics | No | ym:* metric names, passed through as written, e.g. ym:s:visits. Required for stat | |
| dimensions | No | ym:* dimension names, passed through as written, e.g. ym:s:trafficSource |