• Resolved asseti

    (@asseti)


    Hey,

    I’m running into a strange issue on my site. I have a javascript toggleable mobile menu with a jquery click event listener.

    If viewed_cookie_policy has not been set, the menu opens as expected, but once I click “accept all” and viewed_cookie_policy is set to “yes”, a second javascript source appears (VM### filename.js) and duplicates my event listeners, meaning a single click on the menu toggle both opens and closes the menu instantly.

    I suspected it may be a caching issue but disabling my caching plugin (W3 Total Cache) doesn’t resolve the issue, whereas disabling the Cookie Consent plugin does.

    I have also tried disabling “advanced script rendering” but no dice.

    Any ideas? Happy to provide more info if required.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @asseti,

    We will check the issue for you. Please share the site URL.

    Thread Starter asseti

    (@asseti)

    Plugin Author WebToffee

    (@webtoffee)

    Hi @asseti,

    We have checked the site and seems like the advanced script rendering is disabled now. So please enable it and clear the cache. We suspect there is a plugin conflict, so kindly check by deactivating all other plugins

    We noticed that a few scripts have been added twice to the website

    https://staging.assetivity.com.au/wp-content/themes/assetivity/js/dist/bundle.js

    https://staging.assetivity.com.au/wp-content/themes/assetivity/js/libs/jquery.min.js

    https://staging.assetivity.com.au/wp-content/plugins/duracelltomi-google-tag-manager/js/gtm4wp-woocommerce-enhanced.js

    Thread Starter asseti

    (@asseti)

    Thanks, seems to be all working correctly now. I did change caching plugins from W3 Total Cache to LiteSpeed and it didn’t seem to immediately fix it, but still there may have been a conflict there. Not too sure.

    Thread Starter asseti

    (@asseti)

    Hi guys, scratch that, the issue is still happening.

    I tool a look at the network log and I can see that cookie-law-info-public.js is initiating the extra request for bundle.js and gtm4wp-woocommerce-enhanced.js – still not sure where the extra jquery is coming from though.

    Advanced script rendering is turned on, and I have now fully uninstalled W3TC and replaced it with LiteSpeed.

    Disabling other plugins hasn’t fixed the issue, so it seems the issue does lie with Cookie Consent.

    Plugin Author WebToffee

    (@webtoffee)

    Hi @asseti,

    Could you please check if you have added the script that you need to block in more than one category? If yes, please undo that. You will need to add the script under any one category(GDPR Cookie Consent menu > Cookie Category)

    Thread Starter asseti

    (@asseti)

    It’s working now – I went through each category and removed the scripts that were duplicated, they were only included once though. Does removing them from the category mean we are no longer GDPR compliant?

    Plugin Author WebToffee

    (@webtoffee)

    Hi @asseti,

    Just keep one script to any one category to manage using the plugin.
    Eg:
    You can add the Google Analytics Script to the Analytics category head script field.
    If you have a Facebook pixel script, you can add it to either the analytics category itself or to another category.
    However, DO NOT add the GA script itself to multiple categories.

    Hope this clarifies the concerns.

    Thread Starter asseti

    (@asseti)

    Hey @webtoffee, thanks for the help so far.

    To clarify – currently none of the offending scripts are assigned to any of the cookie categories. If I add them to a category, they get duplicated (rather than blocking them until the user accepts the category, which I believe is the intended result?). At no stage were any of the scripts assigned to multiple categories.

    Plugin Author WebToffee

    (@webtoffee)

    Hi @asseti,

    Are these scripts added via any other plugin or via theme directly?

    Thread Starter asseti

    (@asseti)

    Hey @webtoffee, bundle.js and jquery are added via the theme directly, I believe gtm4wp would be added via that plugin.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Duplicate javascript / event listeners on accept’ is closed to new replies.