To display a cookie consent pop-up in Webflow, the best solution balances compliance, design flexibility, and ease of integration.
- OneTrust, Cookiebot, and Termly are top choices that ensure compliance with GDPR, CCPA, and other laws.
- These platforms generate a script for you to embed in your project.
- Go to Webflow Dashboard > Project Settings > Custom Code > Head, and paste the generated script there.
- These services automatically detect cookies, manage preferences, and allow consent logging.
2. Use a Lightweight Custom Script (Only if Compliance Not Mandatory)
If you prefer a basic, visual-only banner without robust consent logging:
- Use a simple script like Osano’s free cookie consent (https://www.osano.com/cookieconsent).
- Customize the banner’s message and style using the provided configuration.
- Example (do not copy this directly into Webflow without modifying via Osano):
- Include the script in Project Settings > Custom Code > Footer.
- Add a
div
block on your page if custom UI handling is required.
3. Customize Banner Visually in Webflow, Script-Only for Storage
If you want full design control:
- Build the cookie banner as a visual Webflow component (e.g., popup with message, accept button).
- Use a small JS snippet in Page Settings > Before
</body>
to: - Save a flag in
localStorage
or cookies
when user clicks “Accept”. - Hide the banner on future visits by checking that flag.
- This does not provide legal compliance tracking, just user-friendly UI.
4. Load Scripts Conditionally
- To respect user preferences, wrap your tracking code (Google Analytics, Facebook Pixel) inside a check:
- Only load the scripts if consent has been given (based on stored flag).
- Webflow doesn’t offer native conditional script loading, so use JS to inject tracking scripts dynamically after consent.
Summary
The best way to show a cookie banner in Webflow is to use a third-party cookie consent manager like OneTrust or Cookiebot for full compliance, or a lightweight custom pop-up with JavaScript for basic UX. Embed scripts via Project Settings > Custom Code, and optionally build the banner in Webflow for better design control.