• Resolved awald

    (@awald)


    I’ve noticed that Cookie Notice does not inject the GA script when WP Super Cache is enabled. I’ve seen a few people point out issues and I’ve seen this thread (https://github.com/Automattic/wp-super-cache/pull/580/files) but I’m not entirely sure how to make it work. Do I put the add_wpsc_cookies() function in functions.php? I’m not a PHP developer and I could use some assistance. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You should contact the developer of Cookie Notice. Point them at this post that I updated this morning and it’ll make sense to them. They should probably be able to make a one line change to their plugin to get things working.

    https://odd.blog/2017/10/25/writing-wp-super-cache-plugins/

    If you don’t want to do that, figure out what cookie that plugin uses, create a file called wp-content/mu-plugins/wpsc-cookie-notice.php and put this code in it:

    <?php
    function add_wpsc_cookie() {
    do_action( 'wpsc_add_cookie', 'COOKIENAMEGOESHERE' );
    }
    add_action( 'init', 'add_wpsc_cookie' );

    Change COOKIENAMEGOESHERE to the name of the cookie you found.

    Reload your blog, browse around a bit and then look in the file wp-content/wp-cache-config.php and see if there’s a line that says:
    $wpsc_cookies = array ( ….. );
    The array should have the cookie you named above.
    Test the cookie banner, is it cached correctly after you click it? You’ll probably have to clear the cache from the settings page to test it properly.

    If it’s there and everything is working then you can delete wp-content/mu-plugins/wpsc-cookie-notice.php

    Thread Starter awald

    (@awald)

    This worked, thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Cookie Notice GA issue with cache enabled’ is closed to new replies.