• Resolved renatefink

    (@renatefink)


    Hi there!
    Due to a new law, I have to provide my customers with a link that allows them to unsubscribe from GA tracking. That’s why I have to create an opt out cookie. Can you please help me with the creation? And where on my site do I have to enter the code?
    Thank you! Best Regards, Renate

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Howdy ??

    I had a look at the site and it appears that you are using this cookie notice plugin: https://www.ads-software.com/plugins/cookie-notice/

    In their documentation, they state:

    If you’d like to code a functionality depending on the cookie notice value use the function below:

    if ( function_exists('cn_cookies_accepted') && cn_cookies_accepted() ) {
        // Your third-party non functional code here
    }

    The current version of the Google Analytics plugin provides a filter named woocommerce_ga_disable_tracking – if a callback function to that filter returns true then the WooCommerce Google Analytics code will not be loaded. So, with that in mind, a code snippet like this would do the trick: https://gist.github.com/WillBrubaker/77bcc2c1ab8fd47c4b948f64a854021c

    Hope that helps. Kind regards.

    Hi there,

    may I know what should happen after woocommerce_ga_disable_tracking is used?
    Tracking code should not be presented or it should be changed?
    Im asking because Ive tried snipped recommended from github, but nothing happened, tracking code is everytime presented.

    Isnt there easy solution like I did with Facebook for Woo Integration?:

    if ( function_exists('cn_cookies_accepted') && !cn_cookies_accepted() ) {
    	add_filter('facebook_for_woocommerce_integration_pixel_enabled', '__return_false', 20);
    }  

    Thanks you

    Well, I found out that

    if ( function_exists('cn_cookies_accepted') && !cn_cookies_accepted() ) {
    	add_filter('woocommerce_ga_disable_tracking', '__return_true', 20);
    }

    is working but there is an conflict with CometCache, that is not reflecting changes.

    Sounds like you’re all set here then.
    Have a fantastic day!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Opt Out Cookie’ is closed to new replies.