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.

Comments

kimberleycgm created an issue. See original summary.

kimberleycgm’s picture

kimberleycgm’s picture

Status: Active » Needs review
kimberleycgm’s picture

Issue summary: View changes

  • svenryen committed 7579e4a on 8.x-1.x authored by kimberleycgm
    Issue #3153182 by kimberleycgm, svenryen: Categories method and '\''EU...
svenryen’s picture

Status: Needs review » Fixed

Let'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!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.