Skip to main content
Mage supports ingesting data from YouTube Analytics by connecting to the YouTube Analytics API and YouTube Data API v3 using OAuth 2.0 credentials. This integration allows you to extract rich channel analytics, video performance, and viewer engagement metrics directly into your Mage pipelines.

🔧 Configuration

To connect to the YouTube Analytics API, provide the following parameters in your source configuration:

🔐 How to Generate Credentials

Follow these steps to generate the required credentials from the Google Cloud Console:

1. Set Up OAuth Credentials

  1. Go to Google Cloud Console
  2. Create a new project (or use an existing one)
  3. Enable the following APIs:
    • YouTube Data API v3
    • YouTube Analytics API v2
  4. Navigate to “APIs & Services > Credentials”
  5. Create a new OAuth 2.0 Client ID (select “Web application” or “Desktop app”)

2. Generate a Refresh Token

Use OAuth 2.0 Playground to get a refresh_token:
  • Click the gear icon and check “Use your own OAuth credentials”, then enter your Client ID and Secret.
  • Select the following scopes:
    • https://www.googleapis.com/auth/youtube.readonly
    • https://www.googleapis.com/auth/yt-analytics.readonly
  • Follow the steps to authorize, exchange code for tokens, and copy the refresh token.

How It Works

This integration connects to two key Google APIs to extract YouTube Analytics data and video metadata:

APIs Used

Supported Streams

The following streams are available in the YouTube Analytics integration:

Sync Behavior

  • Incremental Syncs
    The integration supports stateful incremental loading, so only new or modified records are fetched during each sync run.
  • Schema Output
    Mage automatically generates the output schema for each stream, making it easier to understand and work with the resulting data.