|
Download docs/Documentation_and_API/analytics_reporting.md from aoiandroid/android-times-articles: direct link, hf CLI and curl.
- Browser
- Download file 3.21 kB
-
https://huggingface.co/datasets/aoiandroid/android-times-articles/resolve/main/docs/Documentation_and_API/analytics_reporting.md
- Command line
-
hf download hf://datasets/aoiandroid/android-times-articles/docs/Documentation_and_API/analytics_reporting.md
-
curl -L -o analytics_reporting.md https://huggingface.co/datasets/aoiandroid/android-times-articles/resolve/main/docs/Documentation_and_API/analytics_reporting.md
3.21 kB
YouTube Analytics and Reporting APIs Reference
The YouTube Analytics and Reporting APIs allow you to retrieve viewing statistics, popularity metrics, and other data for YouTube videos and channels. These APIs are essential for building custom dashboards and automating reporting tasks.
1. Choosing the Right API
| Feature | YouTube Analytics API | YouTube Reporting API |
|---|---|---|
| Primary Use | Targeted, real-time queries. | Bulk reports for large datasets. |
| Data Retrieval | Specific data points via API calls. | Pre-defined, downloadable bulk files. |
| Response Time | Faster for small, specific queries. | Slower (asynchronous bulk generation). |
| Storage | Data is not stored by the API. | Supports retrieval and local storage. |
| Best For | Real-time dashboards, user-specific stats. | Mining historical data, deep analysis. |
2. YouTube Analytics API (Targeted Queries)
The Analytics API allows you to execute "targeted queries" to retrieve specific statistics.
Key Concepts:
- Dimensions: How data is grouped (e.g.,
video,country,date,ageGroup). - Metrics: The values being measured (e.g.,
views,likes,estimatedMinutesWatched). - Filters: Narrow down the result set (e.g.,
video==VIDEO_ID).
Common Parameters:
ids: The channel or content owner ID (e.g.,channel==MINEorcontentOwner==OWNER_ID).startDate/endDate: The time range for the report (YYYY-MM-DD).metrics: A comma-separated list of metrics (e.g.,views,likes,comments).dimensions: A comma-separated list of dimensions (e.g.,day,country).sort: Order of the results.
3. YouTube Reporting API (Bulk Data)
The Reporting API is designed for applications that need to process vast amounts of data by downloading bulk reports.
Workflow:
- List Report Types: Find out what reports are available (e.g.,
channel_basic_a2). - Create a Job: Schedule a regular bulk report generation.
- Download Reports: Retrieve the generated CSV files once they are ready.
Advantages:
- Highly scalable for big data applications.
- Provides comprehensive datasets without the complexity of individual query management.
4. Authentication and Authorization
Both APIs require OAuth 2.0 for all requests. API Keys are not sufficient for accessing analytics data.
Required Scopes:
https://www.googleapis.com/auth/yt-analytics.readonly: View YouTube Analytics reports for your YouTube content.https://www.googleapis.com/auth/yt-analytics-monetary.readonly: View monetary and non-monetary YouTube Analytics reports.https://www.googleapis.com/auth/youtube.readonly: View your YouTube account.
5. Support & Resources
- Dimensions & Metrics Reference: Developers Guide
- API Explorer: Try it out
- Code Samples: GitHub - youtube/api-samples
Scores: Importance:8, Urgency:8 Tier: 1