
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
nuxt-simple-cookie-consent
Advanced tools
A lightweight, headless Nuxt 3 module for managing GDPR-compliant cookie consent — with full control over categories, script injection, and UI.
A simple, headless, and fully customizable cookie consent module for Nuxt 3.
Built for developers who want full control over styling and behavior, without relying on bloated third-party libraries.
See the example in the playground (uses Nuxt UI)
analytics
, ads
, or both).required: true
to always enable them and prevent opt-out.useCookieConsent()
composable – Easily track consent preferences, expiration, and control flow in your app.ads
and analytics
).import.meta.client
, avoiding SSR issues.<script>
, <iframe>
, or custom HTML as part of your cookie configuration.onConsentAccepted
onConsentDenied
onCategoryAccepted(category)
onScriptsInjected(category)
onScriptsRemoved(category)
resetPreferences()
and more.Install the module to your Nuxt application with one command:
npx nuxi@latest module add nuxt-simple-cookie-consent
That's it! You can now use nuxt-simple-cookie-consent in your Nuxt app ✨
export default defineNuxtConfig({
modules: ['nuxt-simple-cookie-consent'],
cookieConsent: {
expiresInDays: 180,
consentVersion: '1.0.0',
cookieName: 'cookie_consent',
categories: {
analytics: {
label: 'Analytics',
description: 'Used to improve website performance.',
required: false
},
ads: {
label: 'Advertisement',
description: 'Used for ad personalization.'
}
},
scripts: [
{
id: 'ga2',
src: 'https://www.googletagmanager.com/gtag/js?id=GA_ID',
async: true,
defer: true,
categories: ['analytics', 'ads']
},
{
id: 'ads',
src: 'https://ads.example.com/script.js',
categories: ['ads']
},
{
id: 'ga',
src: 'https://www.googletagmanager.com/gtag/js?id=GA_ID',
customContent: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_ID');
`,
categories: ['analytics']
},
{
id: 'facebook',
customHTML: `
<iframe src="https://www.facebook.com/tr?id=FB_PIXEL_ID&ev=PageView&noscript=1"
height="1" width="1" style="display:none"></iframe>
`,
categories: ['ads'],
src: ''
}
]
}
});
Use the built-in composable to build your own cookie banner, modal, or settings panel:
const {
preferences,
categoryMeta,
updatePreferences,
acceptAll,
denyAll,
acceptCategories,
hasUserMadeChoice
} = useCookieConsent();
Build your UI using Nuxt UI, Tailwind, or anything else.
Preferences are fully reactive and changes are immediately reflected.
You can find example in the playground with Nuxt UI!
Other modules are:
This one gives you just the logic — you handle the rest with your own design system and UX. Well, of course you will get a full working examples, no need to pressure yourself!
required: true
)onConsentAccepted, onConsentDenied, onCategoryAccepted, onScriptsInjected, onScriptsRemoved
)Pull requests, issues, and suggestions are welcome!
If you find a bug or want to propose a feature, open an issue or a PR.
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.