---
title: "Nuxt: Simple Cookie Consent"
url: https://daily.dev/posts/nuxt-simple-cookie-consent-eqcpgkum2
source_url: https://daily.dev/posts/nuxt-simple-cookie-consent-eqcpgkum2
type: freeform
source: "Vuejs&Nuxtjs"
author: "Galabin Vasilev"
published: 2025-06-20T03:27:08.409Z
updated: 2025-06-20T03:27:29.102Z
tags: ["webdev", "privacy", "vuejs", "gdpr", "nuxt"]
reading_time: 2
upvotes: 20
comments: 2
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Nuxt: Simple Cookie Consent

**[Vuejs&Nuxtjs](https://daily.dev/sources/nuxtandvue)** · [@galabinvasilev](https://daily.dev/galabinvasilev) · 2 min read · 20 upvotes · 2 comments

## Summary

A developer has created a lightweight, headless cookie consent module for Nuxt 3 that provides full control over cookie categories, script injection, and consent logic without imposing styling constraints. The module features categorized script control, consent expiration, versioning, event hooks, SSR safety, and development helpers. It's designed as a community-friendly alternative to bloated existing solutions, offering reactive state management and real-time preference handling while remaining experimental and seeking community feedback.

## Content

I'm exited to share my latest project with you - Nuxt Simple Cookies Consent.

https://github.com/criting/nuxt-simple-cookie-consent

Cookie banners have become a default requirement in modern websites — but most solutions I found for Nuxt were either too bloated, too opinionated, or overly complex just to get a consent banner working.

So I decided to build my own — headless, fully customizable, and Nuxt 3-native.

A lightweight module that gives you full control over cookie categories, script injection, consent logic, and expiration — while staying out of your way when it comes to styling and UI.

Features

Here’s what it currently supports out of the box:
✅ Headless design – You build the banner, modals, toggles — I just give you the reactive state and logic.

✅ Categorized script control – Group scripts into analytics, ads, or anything you want.

✅ Support for multi-category scripts – e.g. a single script can belong to both analytics and ads.

✅ Required categories – Enforce required scripts that users can’t disable.

✅ Auto-injection and removal – Based on real-time preferences.

✅ Consent expiration – Re-prompt users after a configurable duration (e.g. 180 days).

✅ Consent versioning – Force re-consent if your cookie policy changes.

✅ Event hooks – Listen to consent lifecycle events like:
    onConsentAccepted
    onCategoryAccepted(category)
    onScriptsInjected(category)

✅ SSR-safe – All scripts only run on the client, avoiding hydration mismatch.

✅ Supports <script>, inline code, custom HTML, <iframe>, etc.

✅ Dev helpers like resetPreferences(), debug logging, and expiration checks.

Still Experimental

I’ve tested it with a few real-world setups, but I definitely need more eyes on it

Contribute or Give Feedback

GitHub repo: https://github.com/criting/nuxt-simple-cookie-consent

Found a bug?
Have ideas for improvements?
Want to contribute?

Pull requests, discussions, and constructive critique are very welcome. Let’s make this a community-friendly solution.
Image

## Community discussion

Top comments from developers on daily.dev.

**@vagsig** · 0 upvotes

> Interesting! Has anyone tried this in production?

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 0 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#privacy](https://daily.dev/tags/privacy), [#vuejs](https://daily.dev/tags/vuejs), [#gdpr](https://daily.dev/tags/gdpr), [#nuxt](https://daily.dev/tags/nuxt)

[View this post on daily.dev](https://daily.dev/posts/nuxt-simple-cookie-consent-eqcpgkum2)
