Support » Plugin: Cookie Information | Free GDPR Consent Solution » The plugin consents works opposite way than intended?

  • Resolved Daniel



    I’ve just tried to finish setting up the plugin when I realised that cookies consents work exactly the opposite way than intended or I’m missing something.

    I put Google Analytics blocking code in consent code area, it looks like this:

    window['ga-disable-UA-XXXXXXXX-X'] = true; // tested and works properly

    I need to mention I havent’t changed the CSS to consent switch, it’s grren/black.

    So when I flip the switch to green to give a consent for GA to run the above code is being fired blocking GA. When I don’t give a consent for GA leaving the switch as is – black – nothing happens, GA works undisturbed.

    To me it the way consents work should be exactly the opposite, when I give the consent for GA (green switch) it should carry on working, when I don’t give a consent (black switch) it should be blocked.

    Best regards, Dan.

    PS, I’ve done little more testing and all cookies on the site work normally when the cookie bar pops up. Shouldn’t they be completely blocked before any consent is given by the site visitor?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Daniel


    Right, so I think I figured that out. 🙂

    The one thing I didn’t mention in previous post is that I’m using another plugin managing GA in WordPress. That plug-in runs GA scripts and installs necessary cookies in the browser.

    Because whenever you write any js code in the script block textarea when setting up a new consent for GDPR, that code is fired only when your consent is positive. That’s why I coudn’t block GA script being run by another plugin. I wanted my code to be fired when the consent is negative. When you decline consent nothing is being fired. I overcame this little shortcomming by using jQuery Cookie plug-in. In my case I made it detect if there is ‘wpgdprc-consent’ with ‘denied’ value cookie present in the browser. If the conditions is true it fires necessary code to block GA and remove all Ga left over cookies , which, the code, is put in enqueued external js file.

    Hope that anything I wrote above is understandable enough to help anyone 🙂

    So the issue is solved?
    If not, let me know!

    Kind regards,

    Merijn Molenaar

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘The plugin consents works opposite way than intended?’ is closed to new replies.