Cookie Consent Service

GDPR-compliant, lightweight cookie consent component for your websites. Built by Dependra, trusted by compliance-focused teams.

GDPR Compliant

Fully compliant with GDPR, ePrivacy Directive, and CCPA. Granular consent categories and easy opt-out.

Lightweight

Only 3KB gzipped. No dependencies. Fast loading, zero impact on performance.

Framework Agnostic

Works with React, Vue, Angular, Next.js, or vanilla JavaScript. Drop-in integration.

Installation

NPM Package (Coming Soon)

npm install @dependra/cookie-consent
# or
yarn add @dependra/cookie-consent

CDN (Available Now)

<script src="https://cdn.dependra.eu/cookie-consent.min.js"></script>
<link rel="stylesheet" href="https://cdn.dependra.eu/cookie-consent.css">

Usage

React / Next.js

import { CookieConsent } from '@dependra/cookie-consent';

function App() {
  return (
    <>
      <YourApp />
      <CookieConsent />
    </>
  );
}

Vanilla JavaScript

import { cookieConsent } from '@dependra/cookie-consent';

// Check if user has consented
if (cookieConsent.isCategoryAllowed('analytics')) {
  // Initialize analytics
  initializeGA();
}

// Listen for consent changes
cookieConsent.on('change', (consent) => {
  if (consent.analytics) {
    initializeGA();
  }
});

Customization

<CookieConsent
  config={{
    policyVersion: '2.0.0',
    onConsentChange: (consent) => {
      console.log('Consent updated:', consent);
    }
  }}
  theme={{
    primaryColor: '#3B82F6',
    position: 'bottom-left'
  }}
/>

Features

GDPR & ePrivacy Directive compliant
Granular cookie categories (essential, functional, analytics, marketing)
Customizable design and branding
Multiple position options (bottom, top, modal)
Consent versioning (re-prompt on policy updates)
LocalStorage-based preference saving
Automatic cookie cleanup on rejection
Multi-language support
Accessibility (WCAG 2.1 AA compliant)
TypeScript support
Zero dependencies
Framework agnostic

API Reference

cookieConsent.getConsent()

Returns the current consent preferences or null if not set.

cookieConsent.saveConsent(preferences)

Save user consent preferences.

cookieConsent.acceptAll()

Accept all cookie categories.

cookieConsent.rejectAll()

Reject all non-essential cookies.

cookieConsent.isCategoryAllowed(category)

Check if a specific category is allowed.

cookieConsent.setCookie(name, value, category, days)

Set a cookie with automatic consent checking.

Free for Dependra Users

This cookie consent service is completely free for all Dependra users. Use it on unlimited websites and projects.