Nuxt Cookie First is a powerful and easy-to-use Nuxt.js module that seamlessly integrates CookieFirst, a GDPR and CCPA compliant cookie consent solution, into your Nuxt.js application. This module enables developers to manage cookies and user consent with minimal effort while providing an optimal user experience.
- Add
nuxt-cookie-firstdependency to your project
# Using pnpm
pnpm add nuxt-cookie-first
# Using yarn
yarn add nuxt-cookie-first
# Using npm
npm install nuxt-cookie-first- Add
nuxt-cookie-firstto themodulessection ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-cookie-first'
],
cookieFirst: {
// Options
apiKey: 'YOUR_API_KEY',
resetTabIndex: false, //If the tabindex of the elements inside the cookie banner layer should be reset to 0
stealthMode: false, //default false
silentMode: false, //default false
language: 'YOUR_DEFAULT_LANGUAGE', //default null
useEuropeanCDN: true //default true - If the European CDN should be used
//host: 'mydomain.at', //automatically detected if not set
}
})- Multi-Domain Setup
export default defineNuxtConfig({
modules: [
'nuxt-cookie-first'
],
cookieFirst: {
sites: [
{
//... Options as in single domain setup (See above)
apiKey: 'YOUR_API_KEY',
host: 'mydomain.at' //required for multi-domain setup to resolve the correct configuration
},
{
//... Options as in single domain setup (See above)
apiKey: 'YOUR_API_KEY',
host: 'my-second-domain.com' //required for multi-domain setup to resolve the correct configuration
}
]
}
})That's it! You can now use Nuxt Cookie First in your Nuxt app ✨
