Problem/Motivation
I'm using this module with the 'opt in with categories' and 'EU only' options and think I've run into a bug. When the IP check is done and the user is not in the EU (therefore doesn't need the banner etc), the status/cookie gets set to agreed as expected. However this then skips loading any scripts that have been set for particular categories.
For example: I have multiple categories, one of which is 'analytics', and in Disable JavaScripts is have analytics:sites/default/files/google_tag/stager_conta/google_tag.script.js. Works fine when the user is in the EU - when they accept, the acceptAction() kicks in and calls loadCategoryScripts(). We need this for non-EU too.
Proposed resolution
To fix this for our site I've patched the code to get all categories, set them as accepted and load the scripts at the point where the status is currently set. Patch attached.
For cases where additional cookie categories are added after this, those categories will have to be auto-accepted too. I'm not sure on the best solution for this, but potentially setting an 'not-eu' cookie in this place and checking against that as well wherever the categories are checked, to always assume all categories for users with 'not-eu' set. However, this would then mean that users outside the EU could not toggle categories on/off with any effect (not sure if they should be able to?). This probably needs more thought but the patch addresses the issue for the simple case.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | eu_cookie_compliance-non_eu_categories_scripts-3153182-2.patch | 851 bytes | kimberleycgm |
Comments
Comment #2
kimberleycgmComment #3
kimberleycgmComment #4
kimberleycgmComment #6
svenryen commentedLet's start with this simple case, and let's those that needs something more elaborate open a new issue. At least this is an improvement and does indeed fix a bug. Thanks for the patch!