Skip to content

Explore how to leverage YouTube Analytics and Reporting APIs to gain in-depth insights and automate reporting. Check out the full guide and practical examples in this article.

License

Notifications You must be signed in to change notification settings

DevRelSquad-blogs/YouTube-Analytics-and-Reporting-APIs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTube Analytics and Reporting API Guide

Overview

This repository contains code examples and instructions on using YouTube Analytics and Reporting APIs to unlock insights from your YouTube channel data. The examples demonstrate setting up API credentials using a service account and accessing key metrics like video views and custom reports.

For additional insights and practical use cases, please see this article on YouTube Analytics and Reporting API Guide.

Setup

Clone the Repository

git clone https://github.com/your-username/YouTube-Analytics-and-Reporting-APIs.git

Navigate to the Project Directory

cd YouTube-Analytics-and-Reporting-APIs

Install Required Libraries

pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib

Set Environment Variable

Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of your service account key:

set GOOGLE_APPLICATION_CREDENTIALS=path\to\your\service-account-file.json

Usage

Retrieve Video Views

Run the Python script read.py to retrieve video views:

python analyze.py

Create and Download Custom Reports

Run the script to create and download custom reports:

python report.py

If you would like more information on generating custom reports, please refer to the practical guide in this article.