Info
Content

Working with YouTube

If you are embedding YouTube videos in your website, you should ensure that these are blocked if no consent is given.

Note: We recommend to use YouTube's "no-cookie codes". In order to do this, simply replace www.youtube.com in the <iframe ...> code with www.youtube-nocookie.com

Example code before changes:

<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/gHTrl91Rdls" 
        frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" 
        allowfullscreen></iframe>

Example code after changes:

<iframe data-cmp-vendor="s30" src="about:blank" class="cmplazyload" 
        width="560" height="315" 
        data-cmp-src="https://www.youtube-nocookie.com/embed/gHTrl91Rdls" frameborder="0" 
        allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" 
        allowfullscreen ></iframe>

For YouTube videos that are bigger than 300x300 pixels, the CMP will automatically apply dynamic content blocking.

Back to top