Chat Widget Not Loading? Cookiebot or CSP May Be Blocking It
If you've correctly installed the chat widget using Google Tag Manager (GTM) or directly in a single-page React app — but it still doesn’t appear — the problem is likely due to:
- Cookiebot blocking scripts until consent is given
- Content Security Policy (CSP) preventing external scripts
- Incorrect GTM tag configuration or load timing
This article explains the cause and gives step-by-step solutions.
🚫 Common Errors You Might See
When inspecting your browser's developer console, you might see:
🔒 Cookiebot Blocking Scripts
Markup
This means Cookiebot is blocking third-party scripts (including your chat widget) before the user gives consent.
🔐 Content Security Policy (CSP) Errors
Markup
This indicates your CSP is too strict and blocks resources like:
- Chat widget scripts
- GTM scripts
- External iframes or fonts
✅ How to Fix It
🔧 Fix 1: Allow Chat Widget Domain in Your CSP
Ask your developer or hosting team to add the following to your Content-Security-Policy
(CSP) headers:
Http
If you're using 'self'
in your CSP, you must explicitly list all allowed domains — including the chat widget script host.
🔧 Fix 2: Configure Cookiebot to Allow the Widget
Cookiebot blocks scripts until users consent to specific categories. Here's how to ensure it allows the chat widget:
Option A: Use data-cookieconsent
Attributes
If injecting manually (HTML or GTM):
Html
This tells Cookiebot: “Only run this script if the user has given functionality consent.”
Option B: Set It Up in Cookiebot Dashboard
-
Log into Cookiebot.
-
Go to "Your Scripts" or "Custom Scripts".
-
Add a new script:
- Set Category to
Functionality
or similar - Paste your chat widget script
- Choose Load after consent
- Set Category to
🔧 Fix 3: Configure GTM Tag Consent Settings
If you're using GTM with Consent Mode, configure your tag:
- In GTM, edit the chat widget tag.
- Go to "Consent Settings".
- Enable “Require additional consent”.
- Add
functionality
(or whatever category you used in Cookiebot).
This ensures GTM will wait for proper consent before injecting the widget.
Test Your Setup
After making these changes:
-
Clear cookies in your browser (to reset consent).
-
Visit your website.
-
Decline cookies — the widget should not appear.
-
Accept cookies — the widget should now appear.
-
In the Dev Console, check:
- Is
window.webchatConfig
defined? - Did the script from
handle-chat-widget.s3.amazonaws.com
load? - Is the widget DOM element present?
- Is
Summary
Problem | Cause | Solution |
---|---|---|
Widget not loading | Cookiebot blocks scripts | Use data-cookieconsent or configure in Cookiebot |
Widget script blocked | CSP blocks third-party sources | Add script-src and frame-src for the widget domain |
Widget not appearing via GTM | Tag loads before consent | Use Consent Settings and DOM Ready trigger |
Widget appears inconsistently | GTM/React race conditions | Load the script dynamically with proper delay |