Info
Content

Working with with YouTube

If you are embedding YouTube videos in your website, you should ensure that these are blocked if no consent is given. In addition to this, we recommend to use YouTube's "no-cookie codes".

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