Support » Plugin: GDPR Cookie Compliance » Accept cookies on scroll

  • Resolved lauratraveler

    (@lauratraveler)


    Hi,

    Is it possible to accept the cookies when a user scrolls? And if not, would it be possible to add this feature in a future version?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there,

    Thanks for your comments,

    You can add the following code snippet to your functions.php, setup the cookies you would like to set true on scroll and the scroll offset (currently is 200px)

    function gdpr_js_extension() {
        ob_start();
        ?>
        <script>
        	jQuery(document).ready(function(){
        		if ( ! document.cookie.match(/^(.*;)?\s*moove_gdpr_popup\s*=\s*[^;]+(.*)?$/) ) {
    				jQuery(this).moove_gdpr_save_cookie({
    					thirdParty: true,
    					advanced: true,
    					scrollEnable: 200
    				});
        		}
        	});
        </script>
        <?php
        echo ob_get_clean();
    }
    add_action( 'wp_footer', 'gdpr_js_extension', 1000 );

    I hope this works.

    @gasparnemes Hi Gaspar, thank you for providing this code, however it doesn’t work for me. Not only the cookie notice doesn’t show anymore, certain site features are broken too. Now, one thing I can think of is that I changed the name of thirdParty cookies to analytical cookies and the advanced one to marketing cookies. Can this have something to do with it? Thanks!

    Hi,
    this could be a great feature if included in the plugin. Scrolling to enable would be very useful.

    Best regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Accept cookies on scroll’ is closed to new replies.