Quantcast
Channel: Topic Tag: footer | WordPress.org
Viewing all articles
Browse latest Browse all 13545

Twansparant on "[Plugin: W3 Total Cache] Exclude footer with Google Analytics cookie check?"

$
0
0

This seems to work:

// Check if cookies are accepted
if ($.cookie('cc_cookie_accept') == 'cc_cookie_accept') {
  console.log('cookies accepted');
  $.removeCookie('cc_page_cache', {
    path    : '/',
    domain  : 'mydomain.com'
  });
} else {
  console.log('cookies not accepted');
  $.cookie('cc_page_cache', 'no_page_cache', {
    path    : '/',
    domain  : 'mydomain.com'
  });
}

Then in the Page Cache settings I added:
Rejected Cookies: cc_page_cache

Only thing is, on the moment the cached pages were created and cookies weren't accepted yet at that point, you will be served the cached pages without the Google Analytics in it although you did accepted the cookies by that time...


Viewing all articles
Browse latest Browse all 13545

Trending Articles