• Resolved McPeanut

    (@beeriz)


    Hello.

    1 – Can we add something to request consent a second time when the user click on “ignore”, and accept only functional cookies?

    I saw similar thing with QC Choice, and I think it is really important to have something like this.

    2 – When showing the modal in the middle of the page, is it possible to grey out the entire page?

    Thank you for this great plugin, we are going to order the premium soon for one website for now.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    What you could do is set the cookie expiration in the banner settings to one day. Then, when a user consents, use a jquery hook to set the expiry to a higher value when the consent level is ‘all’ (marketing level). This will basically set all functional accepted users to an expiration of one day, after which the cookie is gone. But users that accept a higher level, get a longer expiration.

    jQuery(document).ready(function($) {
        $(document).on("cmplzEnableScripts", myScriptHandler);
        function myScriptHandler(consentData) {
            //your code here
            console.log(consentData.consentLevel);
            if (consentData.consentLevel==='all'){
               var expiryDays = 365;
               cmplzSetCookie('complianz_consent_status', 'allow', expiryDays);
            }
        }
    });

    As for your second question: this can be done with some css, but will included in the plugin in one of the future releases.

    To do this right now, you’ll need a minor tweak in the cookiebanner js files to wrap a div around the cookiebanner window
    https://github.com/rlankhorst/complianz-gdpr/tree/add-window-wrap-html-for-cookiebanner
    You only need the complianz-gdpr.php file to up the version number, and the new js files in core/assets/js

    When you increase the version number, your browser will use the new javascript files instead of the old, cached ones.

    Then you can add this custom css to grey out the area around the banner:

    .cmplz-banner-wrap{
        position: fixed;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.7);
        z-index: 99;
    }
    Thread Starter McPeanut

    (@beeriz)

    Thank you!
    I noticed 3 things when applying your code for issue 1,

    1 – The dismiss cookie was set to expire on 06 June 2020 even when 1 day was selected in the settings.

    2 – The button to allow all cookies wasn’t working.
    3 – And these errors were showing in the console :
    0: ‘cmplzSetCookie’ is not defined

    Any idea what’s causing this?
    I also noticed that when setting expiry to 365 days, the “complianz_consent_status” Allow expires on 06 june 2020 instead of one year from now.

    Regarding the area around the banner, do you think this update can be merged with the stable version in the upcoming days?
    Also, I just need to copy the JS files from (https://github.com/rlankhorst/complianz-gdpr/tree/add-window-wrap-html-for-cookiebanner/core/assets) and apply them to our plugin directory?

    Thank you for your crazy fast reply Rogier.

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    I’m sorry, the cmplzSetCookie function is out of scope here, you’ll need to add the code for setting the cookie:

    jQuery(document).ready(function($) {
        $(document).on("cmplzEnableScripts", myScriptHandler);
        function myScriptHandler(consentData) {
            if (consentData.consentLevel==='all'){
                var expiryDays = 365;
                var secure = ";secure";
    
                var date = new Date();
                date.setTime(date.getTime() + (expiryDays * 24 * 60 * 60 * 1000));
                var expires = ";expires=" + date.toGMTString();
                if (window.location.protocol !== "https:") secure = '';
    
                document.cookie = 'complianz_consent_status' + "=" + 'deny' + secure + expires + ";path=/";
            }
        }
    });

    I noticed there is a bug in the original cookieconsent.js file that we used to build the plugin on. I have fixed this in the same branche. But when you override the complianz_consent_status like above, this does not really matter.

    The reason the expirydays is not changing is that this is cached. If you change something in the cookiebanner, like the color or something, the cache will be cleared.

    I’ve just tested it, and this now works fine. If you open it in an anonymous window you should see it working.

    As for going to production: I’ll see what I can do. We’ll have to add this as a new theme, then test it. Won’t be in a few days, but maybe in a week or 2.

    Thread Starter McPeanut

    (@beeriz)

    shouldn’t the part :

    document.cookie = 'complianz_consent_status' + "=" + 'deny' + secure + expires + ";path=/";

    Be :
    document.cookie = 'complianz_consent_status' + "=" + 'allow' + secure + expires + ";path=/";
    Because when using your custom JS, the cookie “complianz_consent_status” is created with the value deny.

    Also, when choosing 1 day or 0 day in expiry of the cookie, it is always 10 days from now, for example, when choosing 1 day expiry, the dismiss cookie will expire on 11 September, when choosing 0 it is 10 septembre !

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Yes, in your setup you’d need allow.

    I can’t reproduce your issue with the date. This works fine for me.

    As for the grey out background: I have made some additional changes, which allows you to enable the soft cookie wall option in the cookie banner settings.
    https://github.com/rlankhorst/complianz-gdpr/tree/add-window-wrap-html-for-cookiebanner

    Thread Starter McPeanut

    (@beeriz)

    Hello.
    I will try to reproduce the issue with the date on a new installation and see if I’m missing something!

    Thank you for all your hard work !

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    @beeriz just made some last changes to this branche for the soft cookie wall: minified files weren’t changed yet.

    Thread Starter McPeanut

    (@beeriz)

    Hello.
    After days of trying to set the expiration correctly, we are 100% certain something is not working as it should with the expiry date.

    It is so random, sometimes we only have to clear cache for it to go as far as 2020 (not even 365 days from now). When we use 1 for example, the expiry date is so random.

    Can we debug this?
    also, should we expect the new version “3.1.0” to be soon available on WordPress?

    Thank you for your help and amazing work.

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Hi @beeriz,

    3.1.0 will be released somewhere next week. With the current release candidate, the 3.1.0 version on github, I do not see the issue. Do you have the expiry date issue with the default code (without hooks to alter the expiry date)?

    Is it possible the cookieconsent.min.js file is still a cached file in your browser cache?

    Thread Starter McPeanut

    (@beeriz)

    Hello.

    We always made sure to ue “Dev console” et disable cache or remove all cookies and content The hooks were disabled, and we were only using the default code.

    That’s why it seemed odd for us that the even the value with the default code wasn’t respected.

    Thank you

    Thread Starter McPeanut

    (@beeriz)

    Hello.

    How to get help for this issue?
    We would like to troubleshoot it and see what’s causing the expiry to act randomly.

    Thank you

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Hi @beeriz,

    Possibly the last time you tried the minified files were not updated yet. I’ve re-minified the files, and tested with minified files. As far as I can see it’s working correctly now. Can you try with a recent zip from Github?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Request consent the next visit’ is closed to new replies.