Cookie Consent - Modal wrapper but just on the first load possible?

Paste this in your site header custom code:

<script>
var Webflow = Webflow || [];
Webflow.push(function() {

  // Load cookie library
  $.getScript('https://cdn.rawgit.com/js-cookie/js-cookie/v2.1.2/src/js.cookie.js', function() {

    // If cookie found (already shown)
    if(Cookies.get('notice') !== undefined) {

      // Hide cookie notice (change jQuery selector to match your own)
      $('.cookies_consent_banner').remove();
    }

    // On button click
    $('.w-button').click(function() {
      // Calculate when you want to display the notice again (change 15 to number of minutes you want)
      var expireTime = new Date(new Date().getTime() + 60000 * 15);
      // Set this cookie
      Cookies.set('notice', 'shown', { expires: expireTime });
    });
  });

});
</script>
3 Likes