Skip to content

dorsium/gdpr-consent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@dorsium/gdpr

npm version GitHub

Lightweight GDPR & Cookie Consent module for Next.js projects. Built by the Dorsium Foundation.

Features

  • GDPR-compliant cookie consent banner
  • Categorized: Necessary, Analytics, Marketing
  • Remembers preferences via localStorage
  • Fully reusable NPM module
  • useConsent() hook for conditional logic
  • Styled with Tailwind CSS
  • Powered by Dorsium branding included

Installation

npm install @dorsium/gdpr

Usage

1. Add the CookieConsent component (e.g. to _app.tsx or layout)

import { CookieConsent } from "@dorsium/gdpr";

export default function App({ Component, pageProps }) {
  return (
    <>
      <Component {...pageProps} />
      <CookieConsent />
    </>
  );
}

2. Use the useConsent() hook to check preferences

import { useConsent } from "@dorsium/gdpr";

export default function AnalyticsLoader() {
  const { hasConsent } = useConsent();

  useEffect(() => {
    if (hasConsent("analytics")) {
      // Load Google Analytics or other trackers here
    }
  }, [hasConsent]);

  return null;
}

3. Optional: Show the Dorsium badge

import { PoweredByDorsiumBadge } from "@dorsium/gdpr";

export default function Footer() {
  return (
    <footer className="text-center mt-8">
      <PoweredByDorsiumBadge />
    </footer>
  );
}

Configuration

No configuration needed. Automatically saves user choices under localStorage['dorsium_consent'].

Only two boolean values are stored:

  • analytics
  • marketing

These flags are kept indefinitely in localStorage until you clear them. No personal data is stored.

Build

npm run build

License

This project is licensed under the MIT License.


© Dorsium — https://dorsium.com


Powered by Dorsium

🔗 View on NPM
🔗 Source on GitHub

About

Lightweight GDPR & Cookie Consent module for Next.js projects. Built by Dorsium.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published