⚖️
Stay compliant without annoying users

Cookie consent that just works, in under 5 minutes.

CookieLaw is a lightweight JavaScript plugin that handles GDPR, ePrivacy, and CCPA cookie banners, preference storage, and audit logs – with 3 lines of code.

Start free – no card
Production ready · Tree-shakable · No trackers
18k+ sites served · < 3KB gzipped
cookielaw.config.js
Live Consent Preview
Environment · Production
Your site, but compliant.
CookieLaw auto-detects third-party scripts and blocks them until consent is granted – without breaking your layout.
Analytics Ads & tracking Functional cookies
Consent rate
Last 30 days
91.3%
Scripts blocked
per 1,000 views
73
Why CookieLaw

Built for devs, approved by legal.

No bloated widgets, no trackers. CookieLaw is a small, audited plugin you can drop into any stack – static sites, SPA, or SSR.

⚙️

3-line integration

Install via npm or load from CDN, initialize with a single call, and CookieLaw handles banners, categories, and consent storage for you.

Works with React, Vue, Next.js, Nuxt, and more.

🛡️

GDPR, ePrivacy & CCPA ready

Region-aware consent flows, granular opt-in, and audit-ready logs for your DPO and legal team. We ship templates vetted by privacy consultants.

Export logs in CSV or JSON when needed.

Ultra-light & fast

Less than 3KB gzipped, zero dependencies, and no layout shift. Bundle it or lazy-load – your Lighthouse score stays green.

<1ms init in real-world bundles.

📊

Consent analytics

Understand which regions and categories get the highest acceptance rates and tune your copy with real data.

Privacy-safe, aggregated metrics only.

🧱

Composable API

Use hooks and callbacks to block scripts, refresh tags, or sync consent status with your CMP or tag manager.

Fine-grained control, simple defaults.

☁️

Self-hosted or managed

Keep everything on your own domain, or use our managed consent endpoints with SLA and regional routing.

Your data, your infrastructure, your choice.

Install

From zero to compliant in 30 seconds.

Install the plugin, initialize it with your categories, and you have a fully functional cookie banner and preference center.

npm / ESM example
// 1) Install
npm install cookielaw

// 2) Import & initialize once in your app entry
import createCookieLaw from 'cookielaw';

const consent = createCookieLaw({
  categories: {
    necessary: { required: true },
    analytics: { required: false, label: 'Analytics' },
    marketing: { required: false }
  },
  regionHint: 'auto', // EU, US, global, or auto-detected
  onDecision(value) {
    // Example: only load analytics if consent.analytics === true
    if (value.analytics) {
      loadAnalyticsScript();
    }
  }
});

// 3) Show banner
consent.showBanner();

Prefer HTML? Drop our CDN script and call the same API:

  • Works on static sites like plain HTML or Hugo.
  • Exposes window.CookieLaw with the same API.
  • Remembers consent for 13 months by default.

Need a custom design? Override our minimal CSS, or completely replace the markup while keeping the underlying consent logic.

Pricing

Start free. Scale when you need to.

Self-host the core library for free forever, or use the managed consent API for enterprise logging and SLAs.

Choose billing:
Pro · Managed consent
$ 29 /site/month

Includes the full JavaScript library, hosted consent logs, and priority support.

Get started in minutes No lock-in. Cancel anytime.
  • Up to 500k page views / month
  • Region-aware flows (EU, UK, US)
  • Exportable consent logs (CSV/JSON)
  • Unlimited test domains & environments
  • Email & chat support with real engineers
FAQ

Answers for both devs and legal.

If you don’t see your question here, reach out – we’re happy to review your specific use case.

Is CookieLaw itself setting any tracking cookies? +
No. CookieLaw only sets a single, strictly-necessary consent cookie that stores your visitors’ choices. It does not track their behavior, and it is not used for analytics or ads.
Does this make my site fully GDPR compliant? +
CookieLaw solves the technical part of consent management: banners, preferences, logs, and script blocking. You still need a proper privacy policy and data processing agreements with your vendors. We provide starting templates for legal review.
Can I self-host everything? +
Yes. The core JavaScript package is completely self-hostable. You can store consent logs in your own database and never send data to our servers if you prefer.
Will CookieLaw slow down my site? +
The library is tiny (<3KB gzipped), shipped as modern JS with no dependencies. It’s designed to initialize in under 1ms on modern devices and can be lazy-loaded if you want it completely off the critical path.
How do I handle multi-language banners? +
You can pass translation strings per locale, or hook into your existing i18n system. CookieLaw exposes the language as a parameter so you can dynamically switch texts without page reloads.
Can I migrate from my existing consent manager? +
Yes. You can keep your current consent cookie for a while and map its values into CookieLaw’s format using a migration callback, so users don’t have to re-consent immediately.
Ready to ship compliant cookies?

Drop CookieLaw into your app, customize the banner, and ship compliant consent flows today – without another meeting.

Want a quick review from our team? Email hello@cookielaw.dev with your stack and traffic profile.