Get Analytics
get_analyticsRetrieve YouTube channel analytics totals or rows broken down by day, video, country, device, and more for a chosen date range.
Instructions
YouTube Analytics for your channel: totals, or rows broken down by one dimension.
Data for the last two or three days is incomplete, so recent rows keep growing. Uses the separate YouTube Analytics API and its quota; enable it in the same Google Cloud project.
Quota: no YouTube Data API units.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| by | No | Break the numbers down by this dimension; its column is named as given here. Omit for totals. By month, the range widens to whole months. | |
| sort | No | Metric or dimension to sort by; prefix with - for descending, e.g. -views. Defaults to chronological by day or month, and to the first metric, descending, by anything else. | |
| limit | No | Maximum number of rows. Breaking down by video returns at most 200, 25 by default; other breakdowns return every row by default. | |
| since | No | First day, inclusive: 2026-01-01, or 90d / 4w before until. Defaults to 28 days before until. | |
| until | No | Last day, inclusive: 2026-01-31, or 7d / 1w ago. Defaults to today. | |
| videos | No | Only these videos (IDs or URLs). | |
| metrics | No | Metric names from https://developers.google.com/youtube/analytics/metrics, e.g. views, estimatedMinutesWatched, subscribersGained. Defaults to views, watch time, average view duration, likes, comments, and subscribers gained and lost. By device, os, traffic-source, playback-location or subscribed, only watch metrics work (views, estimatedMinutesWatched, averageViewDuration, averageViewPercentage), and those are the default. By age or gender, only viewerPercentage works. | |
| my_channel | No | Which of your logged-in channels to work on: UC… ID, @handle or exact title. Omit for the default channel. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | ||
| since | Yes | ||
| until | Yes | ||
| columns | Yes | Dimension first (if any), then the metrics, in request order. |