Webflow sync, pageviews & more.
NEW

What is the best script I can use in Webflow for a pop-up to allow visitors to accept cookies?

TL;DR
  • Visit Osano’s CookieConsent site, copy the CDN script and configuration.
  • Embed the script in Webflow’s Footer code section via Project or Page Settings, customize appearance, then publish your site to activate the pop-up.

To add a cookie consent pop-up in Webflow, it's best to use a lightweight, GDPR-compliant script. One of the most reliable solutions is Osano or Cookie Consent by FreePrivacyPolicy, but for a customizable and code-light approach, CookieConsent by Osano is ideal.

1. Use the CookieConsent by Osano Script

  • Visit https://www.osano.com/cookieconsent.
  • It provides a free script you can easily integrate into Webflow.
  • This script is GDPR and CCPA-compliant and supports full customization.

2. Copy the Script Snippet

  • Go to the Setup page and click Download or CDN.

  • Choose the CDN version for the easiest integration.

  • You’ll get a script snippet like this (shortened here for clarity):

    <script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>

    <script>window.addEventListener("load", function(){window.cookieconsent.initialise({ ... })});</script>

  • You can customize colors, position, theme, and text directly in the config object.

3. Embed the Script in Webflow

  • Go to Project Settings > Custom Code.
  • Paste the CDN script and initialization code into the Footer section of your Site-wide Custom Code.
  • Or, if you want to load it only on specific pages, go to the Page Settings > Custom Code and add it in the Footer section.
  • Example settings to customize within the initialise() config:
  • palette: Button and popup background/text color.
  • theme: Choose 'classic', 'edgeless', or 'block'.
  • position: 'bottom-right', 'top', etc.
  • content: Customize message, dismiss text, link, etc.

4. Publish Your Site

  • After adding the code, publish your Webflow site to see the cookie consent pop-up activated.
  • Test in an incognito/private browser window to verify that the banner appears correctly.

Summary

To add a cookie consent pop-up in Webflow, use the CookieConsent by Osano script for a lightweight, GDPR-compliant solution. Just embed the CDN script into your Webflow project's Footer code section and customize the appearance with their built-in options.

Rate this answer

Other Webflow Questions