YouTube Embed Attribution Tests

Six minimal embed configurations × six distinct YouTube videos × six distinct subdomains, served from one Cloudflare Pages project. The goal is to determine which embed configuration YouTube Studio actually attributes — so we can ship the right pattern for Televika.

All routes receive Referrer-Policy: strict-origin-when-cross-origin from both the _headers file and the routing middleware. Test A omits only the iframe-level referrerpolicy attribute; the server-level policy still applies.

⚠ Use subdomain URLs for real testing. The path-equivalent URLs (e.g., yt.jaan.md/a-current-televika) are for debugging only — they produce a Referer of yt.jaan.md instead of the per-test subdomain, breaking experimental isolation between tests.

Tests

Test Subdomain Path-equivalent (debug) Video ID Purpose Expected learning
A a.yt.jaan.md /a-current-televika lBQfBKQ2-L4 Current Televika baseline Confirms whether Televika's iframe params alone work on a clean referrer-safe domain. If yes, Televika's issue is elsewhere (headers, overlay, SPA env).
B b.yt.jaan.md /b-referrer-policy RTIPjOEVZIE Baseline + iframe referrerpolicy Tests whether the explicit iframe-level referrerpolicy attribute changes attribution beyond the server-level header.
C c.yt.jaan.md /c-origin-api ZrFi-Hi4GBk enablejsapi + origin Tests the IMVBox-style API identity pair (enablejsapi=1 with matching origin) without widget_referrer.
D d.yt.jaan.md /d-widget-referrer UqKvW7ggYWo widget_referrer only Tests whether widget_referrer alone is sufficient as an analytics attribution hint.
E e.yt.jaan.md /e-full-fixed Xepdyj_BDew Full fixed static iframe Main production candidate (all signals combined). If this video appears in YouTube Studio External Sources and others don't, ship this config.
F f.yt.jaan.md /f-full-api-player BLx3d7m8l-c Full YouTube IFrame API player Closest to IMVBox: programmatic player with full analytics-friendly setup. Console logs confirm playback events.

Test execution

Where to look in YouTube Studio

Per video:

  1. Content → select the video → Analytics.
  2. Reach tab → Traffic source: External. Look for entries referencing the corresponding subdomain.
  3. Advanced Mode → check Traffic source type, Playback location, and Direct or unknown (often catches suppressed referrers).

QA checklist (per test page)

  1. Open DevTools → Network.
  2. Find the request to youtube.com/embed/<VIDEO_ID>.
  3. Confirm the Referer header is https://<subdomain>/ — not absent, not no-referrer.
  4. Confirm no YouTube Error 153 in the player.
  5. Play manually and watch 60–120 seconds.
  6. For Test F, confirm DevTools console logs [YT_TEST] … READY and [YT_TEST] … STATE PLAYING.