If your site is plain HTML — a static landing page, a hand-written multi-page site, or anything served asDocumentation Index
Fetch the complete documentation index at: https://docs.cookiechimp.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
.html files — you can install CookieChimp by adding a single <script> tag to your <head>. This guide also doubles as a reference for understanding what every other platform guide ultimately does under the hood.
Copy your CookieChimp snippet
Log in to your CookieChimp dashboard and copy your website's JS snippet:Replace
abc123 with your website's unique CookieChimp ID.Add the snippet to every HTML page
Paste the snippet inside the Replace
<head> of every HTML page on your site, as the very first script.Here’s a complete minimal HTML document with CookieChimp installed correctly:abc123 with your website’s unique CookieChimp ID.The CookieChimp script needs to be the first script in the
<head> section so it can block other scripts before they run and set cookies without consent. If other scripts are added before, they may set cookies and other storage items before consent is granted.Block scripts & cookies
To stay compliant with GDPR and other privacy regulations, you need to actively block non-essential scripts and cookies until the user gives consent. See our Scripts Management Section for full details.The pattern is to change any third-party After — the same tags blocked until the user accepts the Setting
<script> tag from a regular script into a “blocked” script that CookieChimp will only activate once the user consents to the matching category.Before — a Google Analytics tag that runs unconditionally:analytics category:type="text/plain" stops the browser from executing the script. CookieChimp scans the page on load, watches for consent, and rewrites the type back to text/javascript on tags whose data-category the user has accepted.See the Scripts Management page for the full attribute reference, including how to block iframes, images, and inline event handlers.Allow users to update their preferences
CookieChimp provides a floating privacy icon (Privacy Trigger) that lets users manage cookie preferences at any time. Enable it in the banner settings.To open the preferences modal from a custom button or link, add the data attribute A full example with a footer link that opens the preferences modal:
data-cc="show-preferencesModal":How does the script work?
When the browser loadshttps://cookiechimp.com/widget/abc123.js, CookieChimp:
- Reads your configuration (categories, services, banner copy and design) from your account.
- Scans the DOM for any
<script type="text/plain" data-category="...">tags and keeps them blocked. - Shows the consent banner if the user hasn’t made a choice yet — or silently applies their stored consent if they have.
- When the user accepts a category, rewrites the matching blocked tags so the browser executes them.
<head>.
Running code based on consent
If you have custom code that should only run after the user has consented to a specific category, listen for thecc:onConsented event:
cc:onUpdate:
Troubleshooting
- Make sure your domain is allowed in the Account Settings in your CookieChimp dashboard. Local file URLs (
file://) andlocalhostneed to be explicitly added if you want to test before deploying. - The script must be the first script in
<head>. If you see other scripts setting cookies before consent is granted, they were added above the CookieChimp tag. - Make sure you updated every HTML page on your site — pages without the snippet won’t show the banner.
- Enable Debug mode from the CookieChimp dashboard and check the browser JS console for errors.
If you encounter any issues or need further assistance, please reach out to us via our chat.