1.2.9 • Published 12 months ago

nuxt-yandex-metrika v1.2.9

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Yandex Metrika for Nuxt 3

npm version npm downloads License Nuxt

Quick Setup

  1. 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
  1. Add nuxt-yandex-metrika to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: ["nuxt-yandex-metrika"],
});

Configure

{
  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
    // },
  }
}

Options

NameDefault valueTypeDescription
accurateTrackBouncetrueBooleanNumberAccurate bounce rate The parameter can accept these values: true — Enable the accurate bounce rate, with a non-bounce event registered after 15000 ms (15 s). false — Don't enable the accurate bounce rate. (integer) — Enable the accurate bounce rate. Non-bounce events are recorded after ms.
childIframefalseBooleanWhether to record iframe contents without a tag in a child window
clickmaptrueBooleanWhether to collect data for a click map
deferfalseBooleanWhether to disable automatically sending data during tag initialization
ecommercefalseBooleanStringArrayCollect data for e-commerce — Ecommerce. true — Enable e-commerce data collection. Data is transmitted via a JavaScript array named dataLayer in the global namespace (window.dataLayer) false — Disable Ecommerce data collection. (String) — Enable Ecommerce data collection. Data is transmitted via a JavaScript array named in the global namespace (window.) (Array) — Enable Ecommerce data collection. Data is transmitted via a JavaScript
paramsObjectArraySession parameters transmitted during tag initialization To transmit session parameters at any other time, use the params method
userParamsObjectParameters of site users that are transmitted when initializing the tag To transmit user parameters at any other time, use the userParams method
trackHashfalseBooleanHash tracking in the browser's address bar
trackLinkstrueBooleanTrack clicks on outbound links
trustedDomainsArrayIndicates a trusted domain for recording the contents of a child iframe. Contains the domain address of the parent window
type0NumberTag type. 1 for YAN
webvisorfalseBooleanWhether to use Session Replay
triggerEventfalseBooleanWhether to check if the tag is ready

For more information:

Usage

Component NameAuto ImportedDescription
<YandexMetrikaInformer />Shows informer
<YandexVerification />Verification in Yandex Webmaster

Methods

<template>
    <button @click.prevent.stop="reachGoal('click', {})">click</button>
</template>

<script setup lang="ts">
import { useYandexMetrika } from "#imports";

const { reachGoal } = useYandexMetrika();
</script>

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

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

Yakin Nikita - @TakNePoidet

Contributors

License

MIT License

1.2.8

12 months ago

1.2.7

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.9

12 months ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago