To add a cookie consent pop-up in Webflow, use a lightweight script that displays a banner and stores the user’s choice in local storage or cookies. This helps with GDPR compliance.
1. Use a Third-Party Cookie Consent Tool (Recommended)
- Cookiebot and Osano are two widely used, GDPR-compliant tools that integrate easily via script.
- These tools:
- Provide auto-generated scripts.
- Block cookies until consent is given.
- Offer design customization and multilingual support.
Steps to use Cookiebot in Webflow:
- Go to Cookiebot.com and sign up.
- Configure your domain and style in the dashboard.
- Copy the provided JavaScript script tag.
- In Webflow, go to Project Settings > Custom Code.
- Paste the script into the Header or Footer section (as instructed by Cookiebot).
- Publish your site to apply.
2. Use Osano for a Customizable Banner
- Go to Osano.com, create an account, and configure your banner.
- Copy the generated embed script and paste it into Project Settings > Custom Code.
- Osano stores consents and gives you analytics tools.
3. Manual Cookie Banner with Custom Code (Basic Option)
- Use this if you want full control but no third-party dependency.
- Embed a script that checks localStorage, displays a custom div in Webflow, and hides it once accepted.
- Create a custom cookie banner symbol in Webflow with a close button.
- Add interactions to hide the banner when clicked, and stack it with a short script to remember the choice using
localStorage.
Note: Manual banners using basic localStorage or document.cookie do not block cookies automatically and may not be fully GDPR compliant unless you manually configure all scripts to wait until consent is given.
4. Add Script to Webflow Correctly
- Always go to Project Settings > Custom Code > Footer section to insert external scripts.
- Embed the script just before the closing
</body> tag. - If using Site-wide embeds, this ensures the code works across all pages.
Summary
The best solution for a cookie consent pop-up in Webflow is to use a compliant, easy-to-integrate service like Cookiebot or Osano. These tools simplify GDPR compliance and require minimal setup—just embed a script in Webflow’s Custom Code section. For full manual control, you can build a banner using Webflow interactions and local storage, but this requires advanced handling for compliance.