I have EU Cookie Compliance installed on my website.

In the settings I have selected Opt-in option.

On the site front end, I only agreed to the functional cookies but there are cookies set by third party websites which are still saved.

I checked the module's issue queue and found this.

https://www.drupal.org/project/eu_cookie_compliance/issues/3109974#comment-13459494 https://www.drupal.org/project/eu_cookie_compliance/issues/3059471

It seems that this module will not block the third party cookies.

Is there any other way to do this?

  • There is this module drupal.org/project/cookiepro, this service provides an auto-blocking cookie script that you can embed though this goes along with a license.
    – baikho
    Oct 8, 2020 at 21:12
  • This is not a free module. Also I have already the eu cookie compliance module enabled and configured on all of my websites.
    – Ahmad
    Oct 9, 2020 at 4:18
  • A lot depends on how those cookies are set. Our legal department was happy with all our tracking being set via Google Tag manager. Since all browser based privacy blockers block GTM, this is was a clear way for people to opt in to not be tracked by our site except for functional cookies. People who care about this already have stuff like that enabled anyway.
    – CG Monroe
    Oct 9, 2020 at 19:11

1 Answer 1


There's no way for the module out-of-the-box to block cookies created by 3rd party components. That's a simple fact of life. For example, if you by some means inject the code to embed a YouTube video on your site, it'll serve YouTube cookies to visitors to that page and EU Cookie Compliance won't be able to block them. When a YouTube video is served there is a direct communication between YouTube and the browser which other components cannot interfere with.

(In the case of YouTube you can use their cookie-free domain but let's ignore that for the sake of this illustration.)

In order to allow EU Cookie Compliance to prevent YouTube videos appearing to users who haven't accepted cookies, you'll need to implement some Javascript that calls the function Drupal.eu_cookie_compliance.hasAgreed() provided by the module for this purpose and blocks YouTube by some means when they have not. Typically you'll have to alter the embedding code to include your own JavaScript checks and display a suitable placeholder message when a video is blocked.

An example of how to do this for Google Analytics can be found at https://www.drupal.org/node/1648286#comment-6145800

For YouTube, the EU has their own component that does a similar job, that can be seen at https://ec.europa.eu/trustfund-syria-region/content/home_en

You'll need to perform a full audit of all cookies if you want to properly comply with the regulations. That's a larger topic than I can cover here but there are plenty of online guides and tools to get you started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.