One of the problems of using third party services on our Website is that this, if in many cases we know, bring with them cookies that insert users who visit us without, in principle we can do anything.
With This tutorial I propose a way to prevent, when you insert a YouTube video on your Website, you bring with him the cookies of this service.
Preventing YouTube cookies from being inserted.
Insert in WordPress a YouTube video, thanks to the oEmbed implemented from version 4.4 that allows us to simply paste in our post or page the URL of that video.
The problem is that with that url, in addition to the video hosted on Google's platform, we bring its own cookies, both YouTube technical cookies and DoubleClick advertising cookies, which is the platform used by YouTube to show us ads before or under the video in the form of banners. This, in principle, goes against the European Cookie Law, which does not allow us to insert third party cookies without the user's consent.
Fortunately, there is a way to prevent this from happening. In the tutorial that I leave you below you can see how.
Conclusion
As you can see, it's pretty simple to avoid Youtube and DoubleClick cookies.
One option is to add the iframe provided by YouTube with the url https://www.youtube-nocookie.com/embed/, but hopefully soon it will be possible to do this directly as oEmbed in WordPress itself.
Nothing else, I just invite you to leave me your impressions and/or doubts in the contact form and to suggest new topics that you would like me to cover in these tutorials. I will be happy to answer you by email and write in this blog.
Update
I have created a new snippet so that the url change is generated automatically. you can see it in How to modify the url of Youtube videos.