Skip to main content
All CollectionsCookie Banner
How to embed videos on your website without adding targeting cookies? (youtube/vimeo)
How to embed videos on your website without adding targeting cookies? (youtube/vimeo)
Alex Franch Tapia avatar
Written by Alex Franch Tapia
Updated over 3 months ago

The most common players used to embed videos on a website are Vimeo and YouTube. Unfortunately, due when embedding videos onto our website using the default settings, common video players will also add targeting/tracking cookies.

Sometimes, these extra cookies will give you stats on your videos but in many cases they also send data from your website visitors to these companies which they then use for other purposes.

This creates an unnecessary complexity when complying with GDPR and other Data Protection Laws.

Thankfully, they’ve provided a solution.

Embed videos without tracking

Vimeo and YouTube now offer the ability to embed player videos without including extra cookies.

YouTube

YouTube provides privacy enhanced mode for embedded videos to avoid loading any tracking cookies.

Select Privacy mode when embedding

When Embedding a video, you can select the Enable privacy-enchanced mode so that YouTube won’t store any data about your visitors unless they play the video.

Change code manually

You can change the youtube url from www.youtube.com to www.youtube-nocookie.com

// With unwanted cookies 
<iframe src="https://www.youtube.com/embed/DdkOB0htO0" frameborder="0" width="560" height="315" allowfullscreen></iframe>

// Without unwanted cookies
<iframe src="https://www.youtube-nocookie.com/embed/DdkOB0htO0" frameborder="0" width="560" height="315" allowfullscreen></iframe>

If you don’t have access to the YouTube embed code, you can also replace the url by adding the following javascript to the <head> of your site:

 <script type="text/javascript">
var frames = document.getElementsByTagName('iframe');
for (var i=0; i < frames.length; i++)
{
frames[i].src = frames[i].src.replace(/www.youtube.com/gi,'www.youtube-nocookie.com');
}
</script>

Vimeo

Add the Do Not Track parameter dnt=true to your Vimeo URL.

To enable the Do Not Track setting on your Vimeo embed video, simply add ?dnt=true to the end of the URL in the src attribute:

<iframe src="https://player.vimeo.com/video/76979871?dnt=true" width="640" height="360"></iframe>

or if you have other parameters enabled already, replace the ? with &:

<iframe src="https://player.vimeo.com/video/76979871?embedparameter=value&dnt=true" width="640" height="360"></iframe>

Is implementing videos like this compliant?

Implementing videos in without cookies is a less intrusive way, however, personal information is still being sent to the video provider and we still need consent from the user to do so.

Did this answer your question?