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.
Reference pages for the Cookie Consent script
| Page |
What it lists |
| 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 |
| Callbacks and DOM Events |
The 7 callbacks and the 12 DOM events, their arguments, the order they run in, and common callback patterns |
| Read Consent State |
The cookie format and the code that reads it in the browser, PHP, Python, Node.js, Ruby on Rails, and C# |
| DOM and CSS Reference |
Every id, class, and state attribute, the accessibility attributes and keys, and the z-index values |
| Content Security Policy |
The hosts, the minimum policy, and the nonce rules for the loader, the styles, and tagged scripts |
| Consent Storage and Duration |
The 3 cookies, their values and attributes, and the 365-day default |
| Languages |
The 36 language codes and how Cookie Consent picks one |
| Category Mapping |
The categories mapped to Google Consent Mode, Microsoft, Meta, TikTok, and HubSpot signals |
| Known Limitations |
What Cookie Consent does not do, one row per limit |
Guides for single-page apps, self-hosting, upgrades, and A/B tests
| Page |
What it covers |
| Single-Page Apps |
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-Hosting |
Why TermsFeed does not recommend a copy on your server, and the steps when you must self-host |
| Versions and Upgrades |
How to tell which version runs and what differs in 4.0.0, 4.1.0, and 4.2.0 |