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
- Enable Cookiebot auto blocking
- Enable Javascript aggregaiton
- Create a custom form that uses the Drupal states API
- 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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | cookiebot-3516474-3.patch | 4.1 KB | klaasvw |
Issue fork cookiebot-3516474
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
Comment #3
klaasvw commentedThis 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.
Comment #4
giorgoskWorks as expected so far
Comment #5
bramdriesenLeft a comment on the MR