@hexdigital/nuxt-segment
Nuxt Plausible
Nuxt 3 module to integrate Segment analytics 2.0.
Features
- 📯 Track events and page views manually with composables
- 📯 Optionally track page views automatically with the router integration
- 📂
.envfile support - 🧺 Sensible default options
- 🦾 SSR-ready
Quick Setup
- Add
@hexdigital/nuxt-segmentdependency to your project
# Using pnpm
pnpm add -D @hexdigital/nuxt-segment
# Using yarn
yarn add --dev @hexdigital/nuxt-segment
# Using npm
npm install --save-dev @hexdigital/nuxt-segment
Add @hexdigital/nuxt-segment to the modules section of your Nuxt configuration:
// `nuxt.config.ts`
export default defineNuxtConfig({
modules: ['@hexdigital/nuxt-segment']
})
- Add configuration in
nuxtConfig.segmentor innuxtConfig.runtimeConfig.public.segment
This module supports two ways of configuration:
- Directly in key
segmentof the Nuxt config:nuxtConfig.segment - In public runtimeConfig:
nuxtConfig.runtimeConfig.public.segment
Development
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release
Related Packages
@nathanchase/nuxt-dayjs-module
This is a Nuxt 3 compatible module built with the official Nuxt 3 (module-builde...
19,376
31
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.3.5 | ^3.0 | MIT | |
| 1.3.4 | ^3.0 | MIT | |
| 1.3.3 | ^3.0 | MIT | |
| 1.3.2 | ^3.0 | MIT | |
| 1.3.1 | ^3.0 | MIT | |
| 1.3.0 | ^3.0 | MIT | |
| 1.2.3 | ^3.0 | MIT | |
| 1.2.2 | ^3.0 | MIT | |
| 1.2.1 | ^3.0 | MIT | |
| 1.2.0 | ^3.0 | MIT | |
| 1.1.5 | ^3.0 | MIT |