Skip to content

Configuration

To start using the module you have to have configured a provider.

Currently this module supports Cookieinformation, CookieBot and CookieScript. An account for the respective service is required.

General configuration

PropertyTypeDefaultDescription
devBooleanfalseRun code when in development mode
initBooleantrueInitialize the provider script on load

Type declaration

typescript
export type NuxtCookieConsentOptionsLoadStrategy = {
  init: boolean
  dev: boolean
}

Scripts

You can configure which scripts loads for each consent category. Each category accepts an array of script definitions. It uses the same interface as

typescript
export default defineNuxtConfig(() => {
    // ...
    cookieConsent: {
        scripts: {
            necessary: [
                {
                    id: 'uniqeId',
                    src: 'https://example.com/script.js'
                }
            ],
        }
    }
})

Categories

Below are the listed categories for wich you can add scripts for autoloading. If you want to know more about the different categories, and get more in depth understanding of the differences, take a look at the EU Cookies directive page.

PropertyDescription
functionalThese cookies allow a website to remember choices you have made in the past, like what language you prefer, what region you would like weather reports for, or what your user name and password are so you can automatically log in.
marketingThese cookies track your online activity to help advertisers deliver more relevant advertising or to limit how many times you see an ad.
necessaryThese cookies are essential for you to browse the website and use its features, such as accessing secure areas of the site.
statisticAlso known as “performance cookies,” these cookies collect information about how you use a website, like which pages you visited and which links you clicked on.
unclassifiedThese are not an official type of cookies. But many providees offers a state for unclassified cookes. Generally this shouldn't be used.

Type Declaration

typescript
export type NuxtCookieConsentOptionsScripts = {
  scripts: {
    necessary?: Head['script']
    functional?: Head['script']
    statistic?: Head['script']
    marketing?: Head['script']
    unclassified?: Head['script']
  }
}
Build with 🤍 at WEAREHEAVY™