How can you disable cookies set on youtube.com when using the YouTube IFrame Player API with privacy-enhanced mode videos played from the www.youtube-nocookie.com domain?
In the "Turn on privacy-enhanced mode" section in https://support.google.com/youtube/answer/171780?hl=en, it recommends using the www.youtube-nocookie.com domain to:
embed YouTube videos without using cookies that track viewing behavior.
This works well and doesn't set cookies as expected.
However, we use the IFrame Player API (with enablejsapi=1
on the embed params) which does set cookies. We see the following cookies set on the .youtube.com domain:
- YSC
- VISITOR_INFO1_LIVE
These get set as HTTP cookies from the Iframe Player API script at https://www.youtube.com/iframe_api (open a Chrome incognito window and view that script URL directly and inspect the cookies and you'll see the 2 above cookies set). I'm unsure what these cookies are exactly, but they look suspiciously like tracking cookies.
So, the fact that these are set before a user interacts with the video or takes any consenting action, means we can't use the IFrame Player API whilst still being GDPR compliant when it comes to the EU cookie directive.
So the question is, how can we use the IFrame Player API without it setting cookies?
Note: I've posted this with the tag youtube-iframe-api in the hope that Google with answer this as:
We support the YouTube IFrame API on Stack Overflow. Google engineers monitor and answer questions with the youtube-iframe-api tag.
(from https://developers.google.com/youtube/players/support)