- Add
nuxt-yandex-metrika
dependency to your project
# Using pnpm
pnpm add -D nuxt-yandex-metrika
# Using yarn
yarn add --dev nuxt-yandex-metrika
# Using npm
npm install --save-dev nuxt-yandex-metrika
- Add
nuxt-yandex-metrika
to themodules
section ofnuxt.config.ts
export default defineNuxtConfig({
modules: ["nuxt-yandex-metrika"],
});
{
modules: ["nuxt-yandex-metrika"],
yandexMetrika: {
id: 'XXXXXX',
// debug: process.env.NODE_ENV !== "production",
// delay: 0,
// cdn: false,
// verification: null, // Verification in Yandex Webmaster
// options: {
// webvisor: true
// },
}
}
Name | Default value | Type | Description |
---|---|---|---|
accurateTrackBounce | true | Boolean | Number |
childIframe | false | Boolean | Whether to record iframe contents without a tag in a child window |
clickmap | true | Boolean | Whether to collect data for a click map |
defer | false | Boolean | Whether to disable automatically sending data during tag initialization |
ecommerce | false | Boolean | String |
params | — | Object | Array |
userParams | — | Object | Parameters of site users that are transmitted when initializing the tag To transmit user parameters at any other time, use the userParams method |
trackHash | false | Boolean | Hash tracking in the browser's address bar |
trackLinks | true | Boolean | Track clicks on outbound links |
trustedDomains | — | Array | Indicates a trusted domain for recording the contents of a child iframe. Contains the domain address of the parent window |
type | 0 | Number | Tag type. 1 for YAN |
webvisor | false | Boolean | Whether to use Session Replay |
triggerEvent | false | Boolean | Whether to check if the tag is ready |
For more information:
Component Name | Auto Imported | Description |
---|---|---|
<YandexMetrikaInformer /> |
✅ | Shows informer |
<YandexVerification /> |
✅ | Verification in Yandex Webmaster |
<template>
<button @click.prevent.stop="reachGoal('click', {})">click</button>
</template>
<script setup lang="ts">
import { useYandexMetrika } from "#imports";
const { reachGoal } = useYandexMetrika();
</script>
# 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
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Yakin Nikita - @TakNePoidet