PubNio calls YouTube’s GET /v2/reports (youtubeAnalytics.reports.query) to read video and channel analytics.
How PubNio calls it
- Post analytics: the analytics sync makes this call for published posts;
POST /api/v1/analytics/refreshesasks for an early read. - Account analytics: the account sync makes this call;
GET /api/v1/workspaces/{workspaceId}/analytics/accounts/{accountId}returns what it stored. - PubNio asks for a totals report and a daily report with
dimensions=day, filtered to the video for post analytics and to the channel for account analytics. - YouTube’s figures arrive about a day late, and PubNio reads at most 366 days back.
Scopes
- The pinned spec accepts any one of 5 scopes:
https://www.googleapis.com/auth/youtube,https://www.googleapis.com/auth/youtube.readonly,https://www.googleapis.com/auth/youtubepartner,https://www.googleapis.com/auth/yt-analytics-monetary.readonly, andhttps://www.googleapis.com/auth/yt-analytics.readonly. - PubNio’s Google sign-in requests
https://www.googleapis.com/auth/youtube.readonlyandhttps://www.googleapis.com/auth/yt-analytics.readonly, which satisfies it. - Before the post analytics sync makes this call and before the account analytics sync makes this call, PubNio checks that the account granted
https://www.googleapis.com/auth/youtube.readonlyandhttps://www.googleapis.com/auth/yt-analytics.readonly.
Errors
PubNio has no YouTube error code pages yet. Provider error codes covers the providers that have them.
Spec and changes
youtubeAnalytics.reports.query in the pinned spec, revision 20261129. YouTube reference: youtubeAnalytics.reports.query reference.
Checked weekly; no change to GET /v2/reports recorded since this revision. Change tracker.
Limits
- Revenue metrics are not read, and PubNio does not ask for the monetary analytics scope.