# YouTube Analytics setup for PopMCP

You paste the Client ID and Client secret of a Web application OAuth client from your own Google Cloud project, with the YouTube Analytics API and YouTube Data API v3 enabled and the app published.

- Auth: OAuth authorization
- Setup time: 10 min
- API base URL: https://youtubeanalytics.googleapis.com/v2
- Credentials screen: https://console.cloud.google.com/auth/clients
- Provider docs: https://developers.google.com/youtube/analytics/reference/reports/query

## Approval required before this works

Google must verify your OAuth consent screen for the sensitive YouTube scopes (youtube.readonly plus yt-analytics.readonly, and yt-analytics-monetary.readonly for revenue data) before the app can serve users outside your own test-user list.

- Typical wait: Google states 3-5 business days for sensitive-scope verification; developers commonly report 2-6 weeks when the demo video, scope justification or privacy policy is queried.
- Cost: Free. These are sensitive scopes, not restricted ones, so no third-party security assessment fee applies.
- Blocked until approved: Nothing about reading your own analytics. What is blocked is distribution: in Testing publishing status you are capped at 100 hand-listed test users and refresh tokens are invalidated after 7 days, so a persistent connector stops working roughly weekly. Publishing to production unverified still shows every user the 'Google hasn't verified this app' interstitial and keeps the 100-user cap.
- Works meanwhile: Everything. Enable the YouTube Analytics API in a Google Cloud project, create an OAuth client, add yourself as a test user, and reports.query returns live view, watch-time and revenue data for your own channel the same day.

## Before you begin

- A Google account that owns or manages the YouTube channel you want to report on
- A Google Cloud project you can edit. Creating one is free and takes a minute
- Permission to publish the OAuth app under Google Auth Platform, Audience. An app left in Testing gets a refresh token Google expires after 7 days
- Only for revenue metrics: the channel must be in the YouTube Partner Program and you must sign in as an owner

## Get your credentials

### 1. Create the project and enable both YouTube APIs

Use the project picker in the top bar to create a project named `PopMCP YouTube`. Inside it go to APIs & Services, then Library, and enable both YouTube Analytics API and YouTube Data API v3.

Screen: https://console.cloud.google.com/apis/library

### 2. Fill in Branding and set the audience

Open Google Auth Platform, then Branding, and enter the app name, user support email and developer contact email. Open Audience and set User type to External.

Screen: https://console.cloud.google.com/auth/branding

### 3. Add the three YouTube scopes

Go to Data access and click Add or remove scopes. Paste each YouTube scope into the manual-entry box, click Add to table, then Update and Save.

Screen: https://console.cloud.google.com/auth/scopes

### 4. Publish the app

Open Audience, find Publishing status: Testing and click Publish app, then click Confirm.

Screen: https://console.cloud.google.com/auth/audience

### 5. Create the Web application OAuth client

Open Clients and click Create client. Set Application type to Web application, name it `PopMCP`, click Add URI under Authorized redirect URIs and paste the callback URL from the PopMCP connect screen, then click Create.

Screen: https://console.cloud.google.com/auth/clients

### 6. Copy the client ID and secret into PopMCP

Copy Client ID and Client secret from the confirmation dialog into PopMCP, click connect, and approve the consent screen with the account that manages the channel.

Screen: https://console.cloud.google.com/auth/clients

## Fields PopMCP asks for

- OAuth Client ID (clientId) [required]: From your Google Cloud project → APIs & Services → Credentials → OAuth client (type: Web application). Enable BOTH the YouTube Analytics API and the YouTube Data API v3 on that same project first: reports come from the first, and the channel picker from the second.
- OAuth Client Secret (clientSecret) [required]: Stored encrypted; used server-side only and never shown again. Before connecting, publish your OAuth app (Google Auth Platform → Audience → Publish app). An app left in Testing gets a refresh token Google expires after 7 days, so the connection would silently die a week from now. Publishing needs no Google review.

## Callback URL to register

https://app.popmcp.com/api/providers/google/callback

## Scopes requested

- https://www.googleapis.com/auth/yt-analytics.readonly
- https://www.googleapis.com/auth/yt-analytics-monetary.readonly
- https://www.googleapis.com/auth/youtube.readonly

## Verify

PopMCP marks YouTube Analytics as Connected and names the channel you approved. Asking for views and watch time over the last 28 days returns numbers that match the Analytics tab in YouTube Studio.

## Troubleshooting

### Error 400: redirect_uri_mismatch

Cause: The Authorized redirect URI on the OAuth client is not byte-identical to the callback PopMCP sends.

Fix: Copy the callback URL straight from the PopMCP connect screen into Google Auth Platform, Clients, your client, Authorized redirect URIs. Save and wait a minute before retrying.

### The connection works for a week and then fails with invalid_grant

Cause: The OAuth app is still in Testing, so Google expired the refresh token after 7 days.

Fix: Go to Google Auth Platform, Audience, click Publish app so the status reads In production, then reconnect in PopMCP to mint a fresh token.

### 403 accessNotConfigured, or 'YouTube Analytics API has not been used in project ...'

Cause: Only one of the two APIs was enabled, or the OAuth client lives in a different project from the enabled APIs.

Fix: Confirm both YouTube Analytics API and YouTube Data API v3 appear under APIs & Services, Enabled APIs & services for the project that owns the OAuth client.

### Revenue metrics come back empty or 403 while view metrics work

Cause: The channel is not monetised, or the Google account that approved consent is a manager rather than an owner.

Fix: Re-approve with the channel owner account. If the channel is not in the YouTube Partner Program, drop the monetary scope and use the non-revenue reports.

### 'Access blocked: this app has not completed the Google verification process'

Cause: The app is External and still in Testing, and the signing-in account is not on the test users list.

Fix: Publish the app under Google Auth Platform, Audience instead of managing test users. The app stays unverified, so click Advanced and then 'Go to PopMCP (unsafe)' to continue with your own account.

### You want to hand the connector to a wider team

Cause: These YouTube scopes are classed as sensitive, so an unverified published app is capped at 100 consenting accounts.

Fix: Submit the app from Google Auth Platform, Verification center. Verification is not needed for your own channel.

---

Source: https://www.docs.popmcp.com/docs/integrations/youtube-analytics/