How can I embed my YouTube videos

YouTube & GDPR: Embed videos in compliance with data protection regulations

Embedding YouTube videos is a fine thing. You copy the embed code, paste it into a blog article and the corresponding YouTube video is displayed in the article.

Thanks to the Embed function integrated in WordPress, the whole thing is even easier: You simply copy the YouTube URL, paste it into the article and it is in the article.

As far as data protection is concerned, however, this is not entirely unproblematic.

By embedding YouTube videos, various connections are established to Google servers, through which several cookies are stored in your readers' browser and information about them is sent to YouTube and Google's advertising service DoubleClick:

And that even before your readers click on the video!

However, there are several solutions to prevent this and to embed YouTube in a more data-efficient manner.

This blog post is not legal advice! As a blogger and WordPress expert, I have dealt intensively with applicable data protection law, but am not a lawyer. Therefore, I cannot accept any liability for the completeness, topicality and correctness of the content provided by me.

1. Embed with Advanced Data Protection Mode

YouTube itself offers the option of generating embed codes that do not set cookies.

To do this, go under the YouTube video on Share> Embed, scrolls down and puts a check mark next to it Activate extended data protection mode:

PS: By the way, it is a very recommendable video for everyone who needs a kick in the butt!

The videos will then not be from the domain, but from loaded:

However, the method has two disadvantages:

Disadvantage # 1:

First, you need to search the entire blog for YouTube videos and replace each one with the new embed code.

Disadvantage # 2:

Various connections to Google servers are still established (including a cookie, which, however, contains very little information) before the user has even clicked on the video:

After all, significantly less user data is now sent to YouTube. And none at all to the DoubleClick advertising service.

But it can be done even better!

2. YouTube Lyte

With the WordPress plugin YouTube Lyte (which, by the way, comes from the developer of the popular plugin Autoptimize), you can integrate YouTube videos even more efficiently.

The plug-in has the effect that only the preview image is loaded from YouTube servers. The video itself is only loaded after the user has clicked on the play button.

A positive side effect:

The plugin improves the loading time of your website (it was actually designed for this purpose).

It automatically recognizes YouTube videos (also in the form of simple links) and replaces them with the two-click version. That means you don't have to manually replace embed codes!

In terms of design, the whole thing looks almost exactly like the normal YouTube embeds:

According to the Chrome Developer Tools, only one connection to YouTube is established, namely the one for the preview image:

If you want it to be even more data-efficient, you can specify in the settings that featured images are cached on your own server.

This ensures that an external connection to YouTube is no longer established.

As of version 1.7.2, a note text can be displayed under the videos (e.g. to refer to the data protection declaration):

As of version 1.7.3, YouTube videos are no longer from the domain, but from loaded. This is also a very useful improvement for data protection!

3. Borlabs Cookie

The useful plug-in Borlabs Cookie not only offers an opt-in solution for JavaScript, Facebook Pixel and Google Analytics, but also the option to reload YouTube videos.

It offers opposite YouTube Lyte various advantages:

  1. Borlabs Cookie also works for Vimeo videos and any content sent via iframe getting charged.
  2. When displaying the cookie banner, users can give consent for all external media (including Google Maps, Vimeo videos, etc.) at once
  3. It also works without an API key from YouTube
  4. It is updated regularly and offers German support
  5. You don't need a second, third or fourth plug-in for other external services (Borlabs Cookie is an all-in-one solution!)

An embedded video with Borlabs Cookies looks like this:

The YouTube preview image is cached by Borlabs Cookie on your own server. This means that no connection to YouTube servers is established before a user clicks on the button.

If you have copyright concerns, you can also deactivate the thumbnail completely.

Would you like to find out more about Borlabs Cookie? Then take a look at my detailed test report: Borlabs Cookie: Mega instructions and test report (2020)

4. Extra Privacy for Elementor

If you use the page builder Elementor, you can also use the Extra Privacy for Elementor plug-in to integrate a two-click solution into the video widget and only load videos from YouTube or Vimeo after clicking.

In addition, a note text is displayed after clicking the play button:

You can see the plugin in action on the developer's website.

5. Set a link to YouTube

By far the most data-efficient way to show your visitors a YouTube video is with a simple link to the video, such as B .:

The disadvantage, of course, is that your users will then leave your website and be redirected to YouTube.

You may already be aware of this, but for the sake of completeness it should not go unmentioned here.

With WordPress, please remember to really set a link and not just copy the URL into the article. Otherwise, the embed function may automatically replace this URL with an embedded YouTube video.