• We need to implement a plugin to allow users to opt-in to cookies before plugins such as GADWP applies any cookies. Looking at this plugin: https://www.ads-software.com/plugins/cookie-notice/

    I can see from this support page that you have a way of allowing users to opt out by triggering the gaOptout() function when clicking a link/button.

    Is there any way we can trigger that programmatically? The Cookie Notice plugin allows me in the Theme to detect whether the user has opted into cookies or not so I can run different scripts. I want to trigger the gaOptout() function using the Theme, e.g. :

    if ( function_exists(‘cn_cookies_accepted’) && !cn_cookies_accepted() ) {
    // trigger GADWP gaOptout() function as cookies not yet accepted
    <script>gaOptout();</script>
    }

    When I try the above I get a ReferenceError “Can’t find variable: gaOptout”. Not sure if it’s because the GADWP scripts are being included later in the <head> than my code is, or some other reason.

    Any ideas of how to achieve the above requirement (opt-out of cookies/tracking based on settings in another plugin) would be gratefully received.

    Thanks!

    Any ideas on how to achieve this?

Viewing 1 replies (of 1 total)
  • Thread Starter annemarietn

    (@annemarietn)

    Testing it further, I can trigger the gaOptout() if I put the PHP code in the <body>

    What I realise is that it drops the ga-disable-UA-xxx cookie at the point of page load, when the “do you consent to cookies” banner is displayed, but then if the user accepts cookies, the “disable” cookie has already landed.

    What I acutally need is the entire GADWP functions to not run until the user has accepted the cookies in the Cookie Notice, so only at that point are the cookies dropped. Thinking this is not possible and I’ll need to incoporate Google Analytics javascript directly into the Cookie Notice plugin custom scripts, but if you have any thoughts I’d be grateful.

Viewing 1 replies (of 1 total)
  • The topic ‘Opt out via cookie notice plugin’ is closed to new replies.