-- Leo's gemini proxy

-- Connecting to michaelnordmeyer.com:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;lang=en-US

Privacy-Friendly YouTube Embeds


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 exactly 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.


Create a Privacy-Friendlier YouTube Link


To get the privacy-friendlier URL, add `-nocookie` right between `youtube` and `.com` and replace `watch?v=` with `embed/`:


https://www.youtube-nocookie.com/embed/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/embed/aBcDeFgHiJk

If you only have the short version of the URL, replace `https://youtu.be/` with `https://www.youtube-nocookie.com/embed/` 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` and replace `watch?v=` with `embed/`. That means all your old embeds can be easily changed as well.


Vimeo


To sneak in how it’s done for Vimeo, which is a company not driven by advertising revenue, you just have to add `?dnt=true` to the end of the video link, or, if there’s already a question mark preceding other parameters, `&dnt=true`.


Update 2024-03-24


I wrote about how to keep the site’s privacy while embedding.


Embedding YouTube Videos Without Sending the Site’s URL to YouTube

-- Response ended

-- Page fetched on Tue May 21 09:19:10 2024