In general, there are several ways of integrating videos in compliance with GDPR. YouTube already offers 2 variants on the platform.
In the first variant, the videos can be inserted normally. To do this, simply click on Share under the video.
In the next window you can specify how you want the video to be shared and when it should start. If you use CMS systems like WordPress, the displayed URL may be enough.
If you will be inserting the video directly into the page and not using an extra tool, click Embed.
In the case of this variant, you would now paste the code. However, this is not advisable, as your video will then simply set cookies. Read Variant 2 to find out how you can do this better.
This variant consists of the same steps as Variant 1. The difference is that with this variant the domain is changed from:
youtube.com to youtube-nocookie.com
After activating the function, you will be able to insert the video onto your page.
Approximately 18 cookies are stored.
In addition to that, data is written to the local storage.
As you can see here, a lot of information is collected by Google. Among other things, a even a doubleclick cookie is set. This is required to be albe to place user-related advertising across platforms. With Variant 2, this looks better.
In this variant, no cookies are set. See the picture.
With this variant, information is still stored in the local storage.
As you can see here, data is still being written in the local storage. If you don’t want this either, you can load the video only if you have given consent.
Once you have the code, it can easily be customized:
All you have to do is change src to data-src in the above script. The script does the rest.
This is how an overlay would look like if a user has not given consent yet:
The iframe is loaded by clicking on the image or, if the user gives permission, via the consent banner. The picture also includes a link to Google‘s Data Protection Policy.