A lightweight module for integrating Yandex.Metrika into Nuxt, enabling easy analytics setup and tracking user interactions
- ⛰ Simple setup
- 🚠 Automatic tag connection
- 🌲 Support for multiple counters
- Install the module to your Nuxt application with one command:
# Using nuxi
npx nuxi module add nuxt-ym
# Using pnpm
pnpm add -D nuxt-ym
# Using yarn
yarn add --dev nuxt-ym
# Using npm
npm install --save-dev nuxt-ym
- Add nuxt-yandex-metrika to the modules section of nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-yandex-metrika'],
});
That's it! You can now use My Module in your Nuxt app ✨
export default defineNuxtConfig({
modules: ['nuxt-yandex-metrika'],
yandexMetrika: {
counters: [
{
id: <CointerId>,
accurateTrackBounce?: false,
childIframe?: false,
clickmap?: false,
defer?: false,
ecommerce?: false,
params?: {},
userParams?: {},
trackHash?: false,
trackLinks?: false,
trustedDomains?: [],
type?: 0,
webvisor?: false,
triggerEvent?: false,
sendTitle?: false,
}
],
debug: process.env.NODE_ENV !== 'production',
}
});
Local development
# Install dependencies
pnpm install
# Generate type stubs
pnpm run dev:prepare
# Develop with the playground
pnpm run dev
# Build the playground
pnpm run dev:build
# Run ESLint
pnpm run lint
# Run Vitest
pnpm run test
pnpm run test:watch
# Release new version
pnpm run release