Privacy-Friendly YouTube Embeds

Published
Updated
Reading time
2 minutes

I’ll explain how, with little effort, YouTube embeds can be more privacy-friendly, without losing any playback functionality, except that the play wouldn’t show up in the viewer’s YouTube history. Which excactly is the privacy-friendly part, as no YouTube (tracking) cookies are being read or set.

The sample YouTube link doesn’t exists and is only used for demonstration purposes. That means the used video ID (aBcDeFgHiJk) will be different for all your videos.

How To Get the Video URL or Embed-Snippet

If you get the embed snippet from the YouTube video, you can select Enable privacy-enhanced mode to get the privacy-friendly URL in the snippet. Then no manual work is required. But if you just have a shared YouTube link or old embeds on your website, you can easily change those as well.

First, let’s start with how to get an embeddable YouTube URL. The sharing button on YouTube pages displayed in a browser will create a short sharing URL like this:

https://youtu.be/aBcDeFgHiJk

This is a URL, which, when embedded on a web page, will create 3rd-party tracking cookies (Google’s) when watching the embedded video.

But this is not the only way to share from a browser. It’s even easier just to copy the URL from the browser’s location field. The URL for the same video would look like this:

https://www.youtube.com/watch?v=aBcDeFgHiJk

Compared to the short version of the URL, the ID of the video stays the same (aBcDeFgHiJk), just the part in front is different. But this URL also creates tracking cookies.

To get the privacy-friendlier URL, add -nocookie right between youtube and .com:

https://www.youtube-nocookie.com/watch?v=aBcDeFgHiJk

In comparison, first the privacy-violating URL, then the privacy-friendly URL.

https://www.youtube.com/watch?v=aBcDeFgHiJk
https://www.youtube-nocookie.com/watch?v=aBcDeFgHiJk

If you only have the short version of the URL, replace https://youtu.be/ with https://www.youtube-nocookie.com/watch?v= to just keep the ID of the video (aBcDeFgHiJk) in the URL.

Those URL changes mean that you can change all your old embeds as well without having to head to the respective videos on YouTube and create a new embed snippet.

YouTube might track in additional ways, which is always subject to change, but this is an easy way the get rid of some tracking without much effort.

TL;DR: Just copy the video URL from the browser’s location bar and add -nocookie between youtube and .com. That means all your old embeds can be easily changed as well.

Subscribe to updates via RSS feed or via JSON feed