Skip to content
Getting StartedInstallation

Installation for JavaScript

Markdown
Loading…

Install the CookieYes SDK and get a working banner in three steps.

Two packages work with no framework. Pick one:

You wantInstall
The ready-made banner, dialogs and recall button@cookieyes/vanilla: see Banner with no framework
Your own banner, built on the consent engine@cookieyes/core: this page

The rest of this page sets up @cookieyes/core. Two steps, about five minutes.

Prerequisites

RequirementMinimum
Node.js20, for your build tooling
BrowserAny 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.

For a ready-made banner in Vue, Svelte, Angular, Solid or any other framework without a CookieYes adapter, use @cookieyes/vanilla instead.

2. Initialise the runtime

src/consent.ts
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

On this page