Build on the TermsFeed Free Cookie Consent API, callbacks, and cookies
Cookie Consent exposes one global, cookieconsent, whose run() takes 24 options and 7 callbacks, and the script fires 12 DOM events and writes 3 first-party cookies. Look up each option, callback, event, and cookie with what it takes and does. Follow the guides to run Cookie Consent in a single-page app, upgrade it, test 2 versions of the consent banner, and weigh a copy on your own server.
Reference pages for the Cookie Consent script
Look up everything your code calls, reads, or targets in Cookie Consent. Find cookies and languages in Configure, the category mapping in Integrations, and the limits in Compliance.
| Page | What it lists |
|---|---|
| Free Cookie Consent API Reference | The cookieconsent global and its members, the 24 options of run(), tagged script attributes, the cookies in 1 line each, the loader, and the console warnings |
| Free Cookie Consent Callbacks and DOM Events | The 7 callbacks and the 12 DOM events, their arguments, the order they run in, and common callback patterns |
| Read the Consent State | The cookie format and the code that reads it in the browser, PHP, Python, Node.js, Ruby on Rails, and C# |
| Free Cookie Consent DOM and CSS Reference | Every id, class, and state attribute, the accessibility attributes and keys, and the z-index values |
| Content Security Policy (CSP) | The hosts, the minimum policy, and the nonce rules for the loader, the styles, and tagged scripts |
| Consent Cookie Storage and Duration | The 3 cookies, their values and attributes, and the 365-day default |
| Cookie Banner Languages | The 36 language codes and how Cookie Consent picks one |
| Map Categories to Vendor Consent Signals | The categories mapped to Google Consent Mode, Microsoft, Meta, TikTok, and HubSpot signals |
| Limits of Free Cookie Consent: What It Does Not Do | What Cookie Consent does not do, one row per limit |
Guides for single-page apps, self-hosting, upgrades, and A/B tests
Follow one guide per integration task, each with complete code and a check in the browser DevTools.
| Page | What it covers |
|---|---|
| Single-Page Apps and Frameworks | One run() per page load, page views on route changes, and the code for React, Next.js, Vue, Nuxt, Angular, SvelteKit, Astro, and Turbo Drive |
| Self-Host Free Cookie Consent on Your Server | Why TermsFeed does not recommend a copy on your server, and the steps when you must self-host |
| Free Cookie Consent Versions and Upgrades | How to tell which version runs and what differs in 4.0.0, 4.1.0, and 4.2.0 |
| A/B Test Your Cookie Banner | 2 variants of the consent banner, counted from a callback without identifying anyone |