YouTube Analytics

YouTube Analytics (Google Cloud)

Connect your Google account with the official YouTube Analytics API v2 (reports.query). Data is stored only in new tables impact_yt_analytics_* — no changes to existing analytics tables.

Connect Google

User action flow (on this page)

  1. Configure Google Cloud — create OAuth Web client, enable YouTube Analytics API & YouTube Data API v3, set redirect URI to match this app (see status panel).
  2. Set server env varsYT_ANALYTICS_CLIENT_ID, YT_ANALYTICS_CLIENT_SECRET, and ideally YT_ANALYTICS_REDIRECT_URI.
  3. Connect Google — consent screen; we request analytics + readonly YouTube scopes (optional monetary scope for revenue metrics).
  4. Choose date range — defaults to the last 28 days (API uses YYYY-MM-DD).
  5. Fetch preset reports — server calls GET https://youtubeanalytics.googleapis.com/v2/reports with ids=channel==MINE per the official docs.
  6. Optional: custom query — one-off metrics / dimensions / filters / sort (validated) stored under the same tables with a label you choose.
  7. Review history — each API response is saved as raw JSON plus one normalized row per result row (column names → values).
  8. Disconnect (optional) — removes OAuth tokens and all stored fetches/rows for your Impact user.

Data flow

Browser → Impact PHP: connect, disconnect, and “fetch” actions hit this site’s endpoints only.

Impact PHP → Google: OAuth token endpoints; YouTube Data API channels.list?mine=true for channel id/title; Analytics API reports as configured presets.

Google → DB: each report response (columnHeaders + rows) is persisted in impact_yt_analytics_fetch (raw JSON + headers + request params) and impact_yt_analytics_report_row (cells_json: one object per row, keys = API column names).

Reference: Authorization, Channel reports.

Connection status

Loading…

Fetch analytics

Runs multiple documented-style queries (time series, country, device, traffic source, top videos, etc.). Queries that are not valid for your channel return HTTP errors and are still logged with ok=0.

Custom report (single query)

Uses the same date fields as above. Parameters are restricted to safe patterns; invalid dimension/metric pairs still return API errors and are saved with ok=0. See channel reports.

Stored fetches

ID Preset HTTP OK Rows Created

What can be fetched & stored?

  • Metrics such as views, watch time, likes, comments, shares, subscribers gained/lost — and optionally estimated revenue / CPM when the channel and scopes allow it.
  • Dimensions such as day, country, device type, traffic source, video id, live vs on demand — each preset uses a valid-style combination; unsupported combos are skipped in success terms but saved as failed fetches for debugging.
  • Database use — join on impact_yt_analytics_fetch.idimpact_yt_analytics_report_row.fetch_id; parse cells_json in SQL (MySQL JSON_EXTRACT) or in your app; keep response_raw for auditing and re-parsing if Google adds columns.

Boomlet AI Assistant

We're here to help