Problem/Motivation

When using Cookiebot with auto blocking enabled javascript can break in certain situations. When Cookiebot scans a javascript file that may potentially set a cookie the file will be blocked. This is especially a problem when used together with JS aggregation.

Steps to reproduce

  1. Enable Cookiebot auto blocking
  2. Enable Javascript aggregaiton
  3. Create a custom form that uses the Drupal states API
  4. Test the form in Chrome

Proposed resolution

While autoblocking is still a very useful feature it shouldn't break javascript, even if it can potentially set cookies.

The keep autoblocking enabled I'm proposing to exclude all javascript generated by Drupal from being tracked. There are more advanced solutions like https://www.drupal.org/project/cookie_blocking_libraries that allow you to configure every single library, but this doesn't work with aggregation.

CommentFileSizeAuthor
#3 cookiebot-3516474-3.patch4.1 KBklaasvw

Issue fork cookiebot-3516474

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

klaasvw created an issue. See original summary.

klaasvw’s picture

Status: Active » Needs review
StatusFileSize
new4.1 KB

This patch will exclude processed / aggregated JS files from auto blocking.

The reasoning behind this is that by default, drupal core / contrib has no JS that sets cookies that should be blocked automatically by cookiebot. In the rare cases that it does, the developer should opt-out of this behavior by excluding the javascript or library from aggregation.

giorgosk’s picture

Status: Needs review » Reviewed & tested by the community

Works as expected so far

bramdriesen’s picture

Status: Reviewed & tested by the community » Needs work

Left a comment on the MR