Embed YouTube videos with enhanced privacy mode (youtube-nocookie.com)

At the moment Discourse embed YouTube videos with the standard URL. However, Grav rewrites URLs automatically so that it uses the YouTube privacy enhanced mode. Which doesn’t store tracking cookies when people do not play the video. This feature makes cookie/privacy policies a bit easier to write. Is this something Discourse can introduce as well?

Below is a snippet of what Grav automatically generates when inserting a YouTube video into a page. More info about this Grav plugin here.

<div class="grav-youtube-wrapper ">
  <div class="grav-youtube">
      <iframe src="https://www.youtube-nocookie.com/embed/th5KmL-tTI0?cc_load_policy=1&amp;color=white&amp;modestbranding=1&amp;rel=0" frameborder="0" allowfullscreen></iframe>
  </div>
</div>
3 Likes

This is still an issue with European data protection agencies focusing on everything Google.

Would it be an idea to just change the Youtube oneboxing code to always use youtube-nocookie.com instead of youtube.com ?

Would you be accepting a PR for this? @codinghorror @sam ?

2 Likes

We have considered this in the past, but it will have a negative impact on the UX. youtube-nocookie.com doesn’t link viewing activity to your YouTube account, so things like viewing history, recommendations, etc. will stop working.

Note that our YouTube onebox implementation only loads youtube iframe after the user clicks on the thumbnail, so cookies will not be set unless the user interacts with the embed.

That said, adding support for youtube-nocookie.com behind a site setting (or maybe… via a theme component - I think it should be possible :thinking:) would likely be welcome.

5 Likes

A PR is always welcome! Especially if it is a setting. Thank you! :hugs:

3 Likes

Sorry for reviving this. Has anything been done by someone on this feature?

youtube-nocookie.com doesn’t link viewing activity to your YouTube account, so things like viewing history, recommendations, etc. will stop working.

This is absolutely a much more desired outcome considering that on a forum you may end up watching a video linked by someone else just because you are curious and ends up with good old Youtube inundating your feed with videos of that topic.

If nothing has been done, can someone give some pointers at what should this be? A plugin ( changing how the embed if cooked into the db) or a theme component (would it even work?)

3 Likes

+1 on this.

1 Like