Quick overview
This workflow runs every Monday and pulls two comparable 7-day YouTube Analytics reporting windows, calculates week-over-week changes plus the top videos by watch time, then emails an HTML report through Gmail.
How it works
- Runs every Monday at 08:00 (America/Los_Angeles).
- Builds two seven-day date windows (current and previous) using a configurable analytics lag to avoid incomplete recent YouTube Analytics data.
- Queries the YouTube Analytics v2 Reports API for channel-level metrics for the current week and the previous week.
- Queries the YouTube Analytics v2 Reports API for the top five videos in the current week ranked by estimated minutes watched.
- Computes absolute and percentage changes for each metric, formats the results into an HTML email with links to the top videos, and notes any unavailable comparisons.
- Sends the weekly report email via Gmail to the configured recipient.
Setup
- Enable the YouTube Analytics API and create a YouTube OAuth2 connection with a scope that includes yt-analytics.readonly.
- Add a Gmail OAuth2 connection that has permission to send email from your account.
- Replace the recipient_email value (and optionally adjust analytics_lag_days) in the workflow configuration before activating the schedule.