Skip to content

Getting Started

Installation

bash
npx nuxt module add nuxt-c15t

Basic Configuration

Add nuxt-c15t to your nuxt.config.ts:

ts
export default defineNuxtConfig({
  modules: ['nuxt-c15t'],

  c15t: {
    mode: 'offline',
    consentCategories: ['necessary', 'measurement', 'marketing'],
  },
})

Modes

ModeDescription
offlineBrowser-local storage only, no backend needed
hostedUse consent.io managed backend (recommended for production)
self-hostedYour own c15t backend instance

Add the Banner

Drop the consent banner and preferences dialog into your app.vue or layout:

vue
<template>
  <div>
    <NuxtPage />
    <C15tConsentManager />
  </div>
</template>

The banner appears automatically when a user hasn't consented yet. Clicking "Preferences" opens the dialog.

Use the useC15t() composable to reactively check consent state:

vue
<script setup>
const { has, consents } = useC15t()

const hasMeasurement = has('measurement')
</script>

<template>
  <div v-if="hasMeasurement">
    Analytics are enabled
  </div>
</template>

Next Steps