TLDR: Embed YouTube videos, whilst respecting users’ privacy with our plugin for your website.

Working on the website of our new website, we wondered how to embed YouTube videos in way that reduces data sharing with Google, and respects users’ data protection preferences.

EU data protection legislation and similar regimes set high requirements for sharing data with third-parties, such as YouTube. Asking for user consent is usually the most straightforward way to establish a legal basis for such data sharing.

Usage

All you need to use our tool, is to integrate the CSS and JavaScript from the GitHub into your website. Then, you can embed any YouTube video with the following code:

<div class="video_wrapper" style="background-image: url('');">
    <div class="video_trigger" data-source="">
        <p class="text-center">Playing this video requires sharing information with YouTube.<br><a target="_blank" href="https://tosdr.org/#youtube">More information</a></p>
        <input type="button" class="video-btn" value="Agree" />
    </div>
    <div class="video_layer"><iframe src="" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
</div>

Note: The compliance with law has not been checked by lawyers. No liability can be taken beyond the minimum legal requirements. Use at own risk.