See llms.txt for all machine-readable content.

Back to Templates

Send weekly YouTube Analytics channel report with Gmail

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

  1. Runs every Monday at 08:00 (America/Los_Angeles).
  2. Builds two seven-day date windows (current and previous) using a configurable analytics lag to avoid incomplete recent YouTube Analytics data.
  3. Queries the YouTube Analytics v2 Reports API for channel-level metrics for the current week and the previous week.
  4. Queries the YouTube Analytics v2 Reports API for the top five videos in the current week ranked by estimated minutes watched.
  5. 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.
  6. Sends the weekly report email via Gmail to the configured recipient.

Setup

  1. Enable the YouTube Analytics API and create a YouTube OAuth2 connection with a scope that includes yt-analytics.readonly.
  2. Add a Gmail OAuth2 connection that has permission to send email from your account.
  3. Replace the recipient_email value (and optionally adjust analytics_lag_days) in the workflow configuration before activating the schedule.