Installation
Install the CookieYes SDK and get a working banner in three steps.
Two steps, about five minutes.
Prerequisites
| Requirement | Minimum |
|---|---|
| Node.js | 20, for your build tooling |
| Browser | Any modern browser. The engine has no dependencies and no framework requirement |
1. Install
npm install @cookieyes/core@cookieyes/core is the engine alone: it stores and applies consent, runs integrations and blocks requests, and draws nothing. The banner is yours to build, on the consent store.
This is also the package for Vue, Svelte, Angular, Solid and any other framework without a CookieYes adapter.
2. Initialise the runtime
import { initCookieYes } from "@cookieyes/core";
export const { consentStore, consentManager } = initCookieYes({
mode: "cookie-only", // no backend needed
regulation: "GDPR", // "GDPR" | "CCPA"
});Done. consentStore tells you what to show and consentManager records what the visitor chose. Build your own UI renders a banner from them in about 60 lines.
Common mistakes
Nothing appears on the page.
Nothing is meant to. @cookieyes/core draws no UI; it decides what should show and records what the visitor chose. Render the banner yourself from consentStore, as in Build your own UI.
initCookieYes() seems to run twice.
The module that calls it is imported from two places under a bundler that duplicates it, or you call it inside a function. Each call replaces the runtime and logs a warning. Call it once, at module scope, and import the result.
Next steps
- Using the store directly: read, change and react to consent from plain JavaScript
- Build your own UI: a banner and a preferences dialog rendered from the store
- Configuration: every option of
initCookieYes()