Control the display of elements like pop-ups or announcements using the Cookies Webflow Booster. Using browser cookies we can control the display state of an element for a specific period of time. That way, when your user clicks close on a popup, we can decide how long it should be until they see that again. Follow the simple instructions below, or install the official Boosters App for the most simple install and setup possible.
Copy the script source provided below and paste it into the <head>
tag of your custom code settings. If you need assistance with adding custom code in Webflow, click here for more information.
<!-- Flowbase Booster [Cookies] -->
<script src="https://cdn.jsdelivr.net/npm/@flowbase-co/boosters-cookie@1.0.1/dist/cookie.min.js" type="text/javascript"></script>
Locate the main element that contains your cookie content. This element will be shown or hidden based on the cookie status. We recommend using a simple ▭ div-block
to wrap your content.
With the element selected, assign the following attributes:
fb-cookie
Value: true
fb-cookie-duration
Value: 30
The fb-cookie-duration
attribute sets the number of days the cookie will be stored. After this period, the element will become visible to the user again.
To ensure that the cookie content is hidden when the user clicks the close button, add the following attribute to the button or element that will close and hide the cookie element:
Name: fb-cookie-hide
Value: true
This attribute ensures that clicking the button will store a cookie and hide the element until the cookie duration expires.
To prevent the cookie element from flashing or being visible briefly when the page loads, set the main wrapper to be hidden initially. This ensures a smoother user experience. You can do this by applying a display: none;
or visibility: hidden;
style to the wrapper until the cookie status is determined.
After completing the setup and adding both the script and attributes, publish your page. Visit your live staging domain to test the Booster and ensure everything is working as expected.
Your support means the world to us! In just 10 seconds, you can make a big difference:
Thank you for being awesome! 🌟