Get statistics
get_statisticsRetrieve performance reports from Yandex Direct campaigns, including aggregated statistics, day-by-day trends, and detailed search query summaries with sorting and filtering options.
Instructions
Requests a performance report via the Yandex Direct Reports service. By default the report is AGGREGATED over the whole period (one row per object) — add "Date" to fieldNames only for day-by-day dynamics or trend questions. ALL_TIME without a campaign filter is rejected for SEARCH_QUERY/CRITERIA reports; pass campaignIds or a bounded date range. SEARCH_QUERY_PERFORMANCE_REPORT returns a COMPUTED SUMMARY (totals over ALL rows + top-N detail + tail rollup + zero-click/zero-conversion counts), not raw rows — shape it with sortBy/topN/minCost/queryContains/zeroClicksOnly/zeroConversionsOnly, and add Conversions to fieldNames for conversion-based counts. Other report types return tab-separated rows (no header).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topN | No | Max detail rows in the summary (server-capped at 100). Default 50. | |
| order | No | Sort order for detail rows. Default desc. | |
| dateTo | No | End date YYYY-MM-DD (required for CUSTOM_DATE). | |
| sortBy | No | Metric to rank the detail rows by. Default Cost. | |
| minCost | No | Only include rows with Cost >= this in the detail list. | |
| dateFrom | No | Start date YYYY-MM-DD (required for CUSTOM_DATE). | |
| fieldNames | No | Report columns (must be valid for the report type). | |
| includeVat | No | Whether costs include VAT. Default true. | |
| reportType | No | Report type. Default CAMPAIGN_PERFORMANCE_REPORT. | |
| campaignIds | No | Limit the report to these campaign ids. | |
| dateRangeType | No | Predefined date range. Inferred as CUSTOM_DATE when dateFrom/dateTo are given. | |
| queryContains | No | Only include rows whose query/criterion contains this substring (case-insensitive). | |
| zeroClicksOnly | No | Only include rows with 0 clicks in the detail list. | |
| zeroConversionsOnly | No | Only rows with clicks>0 and 0 conversions (needs Conversions in fieldNames). |