Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor jarnovos

    (@jarnovos)

    Hi @slazt,

    The code in the article (https://complianz.io/add-a-link-to-show-the-cookie-banner/) has been updated for Complianz 6.0, as the classes had changed in this version of the plugin.

    Replacing your current “show banner on click” code with the updated version, attached below, should do the trick. Please remove the <?php on line 1 of the script when you are not implementing it as an MU Plugin.

    <?php
    /**
     * Show the banner when a html element with class 'cmplz-show-banner' is clicked
     */
    function cmplz_show_banner_on_click() {
    	?>
    	<script>
            function addEvent(event, selector, callback, context) {
                document.addEventListener(event, e => {
                    if ( e.target.closest(selector) ) {
                        callback(e);
                    }
                });
            }
            addEvent('click', '.cmplz-show-banner', function(){
                document.querySelectorAll('.cmplz-manage-consent').forEach(obj => {
                    obj.click();
                });
            });
    	</script>
    	<?php
    }
    add_action( 'wp_footer', 'cmplz_show_banner_on_click' );

    Kind regards,
    Jarno

    Thread Starter slazt

    (@slazt)

    Hi Jarno,

    Thanks for the answer.
    I replaced the show banner on click function and now the button doesn’t show up anymore. Is there another setting I should change ?

    Thanks
    Stephane

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @slazt,

    Could you try visiting your site in an Incognito window by using the URL attached below, accepting/denying the Cookie Banner to close it, and then clicking the button once more? https://www.slazt.com/?nocache

    I just tested the button using that URL (which displays a version of the site prior to any caching/optimizations), which appears to work fine on my end!

    If that works for you as well, I’d expect this to be solved by doing a Purge/Clear All action in your optimization plugin.

    Kind regards,
    Jarno

    • This reply was modified 2 years, 10 months ago by jarnovos.
    Thread Starter slazt

    (@slazt)

    Hi,

    It seems to work on the mobile and website under Chrome (after purge) but not under firefox. Weird!

    Regards

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @slazt,

    I tried the website in Firefox (latest version) just now, and this seems to work fine for me.

    Please find a short example video/GIF of the behavior in Firefox, attached on the link below. It’s now working without the ?nocache parameter as well: https://gyazo.com/379d71283a3ccc5fbec67a04bd6e30f8

    Thread Starter slazt

    (@slazt)

    Hi,

    I checked on an alt computer and I confirm it works just fine (don’t know why on my main computer, even after clearing cache and cookies…)

    Thanks for your help and have a nice day!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Consent fixed button not working after update’ is closed to new replies.