YouTube oEmbed & Cookies
-
Hi,
This is not a support request per se, more me wondering aloud if that could be a realistic idea, as some functionalities in the performance lab plugin already can impact a site as a whole (i.e. use of WebP) from one setting. Feature request?Been thinking of multiple ways to do it, and IMHO, the performance lab plugin could be the right place, to avoid changing a core component, or develop a specific plugin.
Q: how to conform to privacy laws (i.e. GDPR) on embedded YouTube videos, using oEmbed, on a site with multiple pages (one of my blogs has 2000 posts for example).
YouTube has been allowing a “nocookie” URL for videos, via an option in the share box, resulting in a modified iframe to paste.
If you try to manually change just the URL with nocookie, YouTube oEmbed on WP doesn’t work as it’s not recognized as a valid input.But comparing the resulting code, there’s not a lot of differences…
Code generated by the oEmbed block
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper"> <iframe title="M People - Moving on Up" src="https:// www.youtube.com/embed/zkHOVJINRD8?feature=oembed" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" data-origwidth="580" data-origheight="326" style="width: 580px; height: 326px;" width="580" height="326" frameborder="0"></iframe> </div></figure>
Code generated by YouTube share, with “privacy” option active:
<iframe loading="lazy" src="https:// www.youtube-nocookie.com/embed/zkHOVJINRD8" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" data-origwidth="560" data-origheight="315" style="width: 580px; height: 326.25px;" width="560" height="315" frameborder="0"></iframe>
A: The “iframe” content is mostly the same, but it declares the video with a “youtube-nocookie” URL and adds a lazy load, mainly.
Of course, I suppose it would be possible to modify the YouTube oEmbed part of WP, to add a “Yes/No” selection for privacy in the block options.
But would it be possible (or a good idea?) to add this Yes/No option in the performance lab plugin, that will then cover a site as a whole? When clicking it would/could purge (all) oEmbeds too…This was my 2cts…
Sincerely
DJM
- The topic ‘YouTube oEmbed & Cookies’ is closed to new replies.