• Resolved mme000

    (@mme000)


    I like your cache feature and I would like to use it with my website.
    Unfortunately, I wasn’t able to make the “Cookie Notice for GDPR” plugin working with it.
    That plugin uses some js code and a cookie, inserted in each page, to show a banner which informs the user about the use of cookies and the related implications on privacy and must be shown until the user accepts it.
    So, I cannot insert the cookie used by the plugin in the list of cookies that will prevent caching when set, because no page would be cached.
    Is there any way to solve this problem?

    Thx,

    mme000

    • This topic was modified 5 years, 5 months ago by mme000.
    • This topic was modified 5 years, 5 months ago by mme000.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Hi @mme000

    If the plugin uses only JS and a cookie, it should still work fine, even when cached.

    If you need to enable or disable functionalities if a user declines the use of cookies, it’s a different issue.

    Would you be able to share your website’s URL?

    Marc.

    Thread Starter mme000

    (@mme000)

    Hi Marc and thanks for your reply.
    The website is https://www.cristinacanocchia.com
    Currently the cache is disabled so the cookie notice works as it should (it is the banner which appears at the bottom of each page until the Ok button is pressed).
    The name of the cookie used by the plugin is cookie_notice_accepted.

    • This reply was modified 5 years, 5 months ago by mme000.

    Thanks for the details.

    Looking at the notice setup, I don’t see a reason why it wouldn’t work. Because it’s just a notice and doesn’t affect functionality.

    What happens when you enable caching?

    Thread Starter mme000

    (@mme000)

    Hi Marc, I enabled the cache and cached the home page.
    Now, if you open your browser, remove the cookie_notice_accepted cookie and navigate to https://www.cristinacanocchia.com, the cookie notice will not appear while it should.

    Thank you. I noticed that the plugin doesn’t output the html for the notice once it’s been clicked.

    I’ll look into it.

    Marc.

    Thread Starter mme000

    (@mme000)

    Made some debugging.
    The problem seems to be in this piece of code.

    $.fn.showCookieNotice = function( type ) {
    	// trigger custom event
    	$.event.trigger( {
    		type: 'showCookieNotice',
    		value: type,
    		data: cnArgs
    	} );
    
    	var notice = this;
    
    	switch ( type ) {
    		case 0:
    			if ( cnArgs.hideEffect === 'fade' ) {
    				// show cookie notice
    				notice.css( { 'visibility': 'visible', 'display': 'none' } ).fadeIn( 400 );
    			} else if ( cnArgs.hideEffect === 'slide' ) {
    				// show cookie notice
    				notice.css( { 'visibility': 'visible', 'display': 'none' } ).slideDown( 400 );
    			} else {
    				// show cookie notice
    				notice.css( { 'visibility': 'visible' } ).show();
    			}
    			break;
    ...

    If the cookie_notice_accepted cookie doesn’t exist, the showCookieNotice function is called, but, if the page is cached, the show() function does not make the banner appear.

    I also noticed that it happens only if the page was cached when the cookie_notice_acceped cookie was already set. If it is cached when the cookie_notice_accepted cookie was not set, everything seems to work fine.

    @mme000 Thanks for the extra information. It seems that the plugin only outputs the Html markup when the cookie isn’t set.

    If you want to cache your pages without the cookie being set, you can run the preloader.

    I’ll look into adding better compatibility.

    Marc.

    Thread Starter mme000

    (@mme000)

    Hi Marc,
    unfortunately this solution doesn’t work.
    The preloader does not visit every page (for example, it doesn’t visit the additional pages reachable via the navigation control at the bottom of the home page) so, for those pages, the problem persists.
    In EU, showing the cookie notice is required by law, so, unfortunately, I have to disable the WP-Optimize cache.

    Hi @mme000,

    I looked into this, and adding the following bit of code in functions.php or in a mu-plugin should fix the issue: add_filter('cn_is_cookie_set', '__return_false');

    Thread Starter mme000

    (@mme000)

    Thank you Marc, it seems to work.

    mme000

    algeorgiadis

    (@algeorgiadis)

    I have the same problem with this -> https://el.www.ads-software.com/plugins/cookie-law-info/ plugin.
    When the cache is closed, it works as intented, but when I enable caching, the cookie doesn’t change (the non-necessary cookies cookielawinfo-checkbox-non-necessary always get the predifined value) so if I enable or disable the non-necessary cookies and accept the cookies it will get the predefined value.
    The plugin works the same way as Marc described above “uses some js code and a cookie, inserted in each page, to show a banner which informs the user about the use of cookies and the related implications on privacy and must be shown until the user accepts it.
    So, I cannot insert the cookie used by the plugin in the list of cookies that will prevent caching when set, because no page would be cached.”

    Any help on this would be appreciated.

    Thank you

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to use cache with Cookie Notice for GDPR plugin’ is closed to new replies.