GDPR-compliant, lightweight cookie consent component for your websites. Built by Dependra, trusted by compliance-focused teams.
Fully compliant with GDPR, ePrivacy Directive, and CCPA. Granular consent categories and easy opt-out.
Only 3KB gzipped. No dependencies. Fast loading, zero impact on performance.
Works with React, Vue, Angular, Next.js, or vanilla JavaScript. Drop-in integration.
npm install @dependra/cookie-consent # or yarn add @dependra/cookie-consent
<script src="https://cdn.dependra.eu/cookie-consent.min.js"></script> <link rel="stylesheet" href="https://cdn.dependra.eu/cookie-consent.css">
import { CookieConsent } from '@dependra/cookie-consent';
function App() {
return (
<>
<YourApp />
<CookieConsent />
</>
);
}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();
}
});<CookieConsent
config={{
policyVersion: '2.0.0',
onConsentChange: (consent) => {
console.log('Consent updated:', consent);
}
}}
theme={{
primaryColor: '#3B82F6',
position: 'bottom-left'
}}
/>Returns the current consent preferences or null if not set.
Save user consent preferences.
Accept all cookie categories.
Reject all non-essential cookies.
Check if a specific category is allowed.
Set a cookie with automatic consent checking.
This cookie consent service is completely free for all Dependra users. Use it on unlimited websites and projects.