• Skip to main navigation
  • Skip to main content
  • Jump to the main sidebar

Carlosmdh

  • Migra ahora a Google Analytics 4
  • Blog
  • Snippets
  • Tutorials
  • Q&A GA4
  • About Me
  • Contact Me

How to prevent YouTube from inserting your own cookies

22 junio, 2020

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.

Table of contents

  • Preventing YouTube cookies from being inserted.
  • Conclusion
  • Update

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.

European Cookie Law

Sidebar

Sidebar-Alt

Blog - Snippets - Tutorials

Privacy Policy - Cookie Policy - Change your Consent


carlosmdh © 2023 · Made with by carlosmdh

We use cookies to give you the best experience on our website.

Puedes aprender más sobre qué cookies utilizamos o desactivarlas en los ajustes.

Carlosmdh
Powered by  GDPR Cookie Compliance
Privacy summary

This website uses cookies so that we can provide you with the best possible user experience. Cookie information is stored in your browser and performs functions such as recognising you when you return to our site or helping our team understand which parts of the site you find most interesting and useful.

Strictly necessary cookies

Strictly necessary cookies must always be enabled so that we can save your cookie settings preferences.

If you disable this cookie we will not be able to save your preferences. This means that each time you visit this website you will have to enable or disable cookies again.

Cookies de terceros

Esta web utiliza Google Analytics para recopilar información anónima tal como el número de visitantes del sitio, o las páginas más populares.

Dejar esta cookie activa nos permite mejorar nuestra web.

¡Por favor, activa primero las cookies estrictamente necesarias para que podamos guardar tus preferencias!

Cookies adicionales

Esta web utiliza las siguientes cookies adicionales:

(Lista aquí las cookies que estás utilizando en la web.)

¡Por favor, activa primero las cookies estrictamente necesarias para que podamos guardar tus preferencias!

  • Español
  • Français