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
- 50–80 manual plays per video is the recommended minimum.
- Each play should watch 60–120 seconds.
- Use different real users, devices, and networks. Mass plays from one device/IP will be suppressed by YouTube.
- Always play from the subdomain URLs, not the path-equivalents.
- Wait 48–72 hours before checking YouTube Studio.
Where to look in YouTube Studio
Per video:
- Content → select the video → Analytics.
- Reach tab → Traffic source: External. Look for entries referencing the corresponding subdomain.
- Advanced Mode → check Traffic source type, Playback location, and Direct or unknown (often catches suppressed referrers).
QA checklist (per test page)
- Open DevTools → Network.
- Find the request to
youtube.com/embed/<VIDEO_ID>. - Confirm the
Refererheader ishttps://<subdomain>/— not absent, notno-referrer. - Confirm no YouTube Error 153 in the player.
- Play manually and watch 60–120 seconds.
- For Test F, confirm DevTools console logs
[YT_TEST] … READYand[YT_TEST] … STATE PLAYING.