Nuxt ​
The Nuxt module wires everything up automatically — no manual imports or plugin registration needed.
Setup ​
Add the module to your nuxt.config.ts:
ts
export default defineNuxtConfig({
modules: ['attribution-kit/nuxt'],
attribution: {
ttlDays: 30,
},
})That's all. The module:
- auto-imports
useTracking()everywhere — no import line required - initializes tracking automatically on first page load via a client plugin
- reads your options from the
attributionkey throughruntimeConfig
Usage ​
Because the composable is auto-imported, you can use it directly in any component:
vue
<script setup lang="ts">
const { tracking, getPayload } = useTracking()
</script>
<template>
<pre>{{ tracking }}</pre>
</template>Sending attribution with requests ​
Call getPayload() wherever you make API calls (for example a custom $fetch wrapper or an axios interceptor) and merge it into the request body:
ts
const body = { ...formData, ...getPayload() }
await $fetch('/api/leads', { method: 'POST', body })See all available options in the API reference.