Category scripts aren't removed

Created on 30 May 2025, about 1 month ago

Problem/Motivation

The f353f60474 commit introduced a subtle bug with category based cookies.

Steps to reproduce

Create a disabled cookies config like:

google-analytics:modules/contrib/google_tag/js/gtm.js||google_tag/gtm

The script is no longer removed because the added logic doesn't take categories into account.

Proposed resolution

Remove the part of the code with the filter logic.

Remaining tasks

Provide issue fork.

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @codebymikey
  • Pipeline finished with Success
    about 1 month ago
    Total: 49s
    #510315
  • Pipeline finished with Success
    about 1 month ago
    Total: 49s
    #510317
  • 🇳🇿New Zealand atowl

    Hi @codebymikey,

    Can't delete that bit of code, thats responsible for weeding out any scripts that won't be loaded on the page.

    I'm working on a solution at the js script end presently to fix it.

  • Can't delete that bit of code, thats responsible for weeding out any scripts that won't be loaded on the page.

    Is that really the case? From my tests and inspecting the code, the $disabled_javascripts entries are weeded out here, in particular: unset($javascript[$script]);, which is what the array_filter() was doing anyway.

    I'm working on a solution at the js script end presently to fix it.

    That's good to know, hopefully it's something similar to Klaro, where the script tags are replaced with a placeholder one that gets evaluated as a script when the user accepts cookies:

    <script type="text/plain"
        data-type="text/javascript"
        data-eucc-category="analytics"
        data-eucc-attach-behavior="customModule"
        data-name="custom_module"
        data-src="/modules/custom/custom_module/js/custom.js">
    </script>
    
  • Pipeline finished with Success
    21 days ago
    Total: 70s
    #519245
  • Pipeline finished with Success
    21 days ago
    Total: 49s
    #519247
  • 🇳🇿New Zealand atowl

    Hi @codebymikey,

    I've pushed a change to a new issue fork here, could i get you to test it and let me know how it goes?

    As much as i would like to change to what you have suggested, i can't do it just yet. I'd like to just get the module a bit more cleaned up first.
    BUT! lets create a feature request, and get it done as i do think that's a good idea!

  • Pipeline finished with Success
    20 days ago
    Total: 44s
    #520179
  • First commit to issue fork.
  • Pipeline finished with Success
    20 days ago
    Total: 49s
    #520722
  • Merge request !164Fix: Opt-in by category. → (Closed) created by progga
  • 🇬🇧United Kingdom progga

    Hello,
    This change seems to work for us. If you can please take a look.

    Thanks.

  • Pipeline finished with Success
    19 days ago
    Total: 50s
    #521067
  • 🇳🇿New Zealand atowl

    Hi - going to close this as being fixed, a lot more of the discussion was made in #3528439.
    If it wasn't fixed, feel free to reopen.

  • It seems like the latest commit doesn't work for my use case. I've updated the issue summary with steps to replicate the issue.

    Unfortunately don't think I'll be able to test and work on this further as I'll be working on migrating to Klaro next, I just thought I'd document this in here because the next version is released.

Production build 0.71.5 2024