# vue3-yandex-metrika

> Yandex Metrika plugin for Vue3

Latest version **0.0.4** (published 2023-09-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue3-yandex-metrika
pnpm add vue3-yandex-metrika
yarn add vue3-yandex-metrika
bun add vue3-yandex-metrika
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2023-09-04 |
| First published | 2021-10-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 120.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Eugene Fedoryachenko |
| Maintainers | mdwitr0 |
| Keywords | vue3, tracking, Yandex, yandex, Yandex Metrica, yandex metrica, Yandex Metrika, yandex metrika, yandex tracking, vue3-yandex-metrika, vue-v3-yandex-metrica, vue-v3-yandex-metrika, vue-yandex-metrika, Яндекс, яндекс, Яндекс Метрика, vue yandex metrika, vue3 yandex metrika, vue3 яндекс метрика, яндекс метрика |

## Links

- npm: https://www.npmjs.com/package/vue3-yandex-metrika
- Repository: https://github.com/mdwitr0/vue3-yandex-metrika
- Homepage: https://github.com/mdwitr0/vue3-yandex-metrika#readme
- Issues: https://github.com/mdwitr0/vue3-yandex-metrika/issues
- npm.io page: https://npm.io/package/vue3-yandex-metrika

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2023-09-04
- 0.0.3 — 2021-10-07

## README

<p align="center">
    <img src="https://i.imgur.com/iu7VdZ7.png" />
</p>


# Vue v3 Yandex Metrika

**vue3-yandex-metrika** allows you to send data about visited pages to [Yandex Metrika].

## Installation

Install with [yarn]:

```bash
$ yarn add vue3-yandex-metrika
```

Install with [npm]:

```bash
$ npm install vue3-yandex-metrika --save
```


## Ways to use

### <a name="autotracking">Autotracking</a>

Pass the` VueRouter` instance to the plugin and let it handle everything for you ([Metrika API] is also available):
```javascript
// your main.js
import { createApp } from 'vue'
import { createRouter } from "vue-router";
import VueYandexMetrika from 'vue3-yandex-metrika'                               

const router = createRouter({...}) // your routes

const app = createApp(App)

app.use(router)
app.use(VueYandexMetrika, {
	id: XXXXXXXX,
	router: router,
	env: process.env.NODE_ENV
    // other options
})

app.mount( '#app')
```


### <a name="manual">Manual tracking</a>

Works without router: [Metrika API]
```javascript
// your main.js
import { createApp } from 'vue'
import VueYandexMetrika from 'vue3-yandex-metrika'                               

app.use(VueYandexMetrika, {
	id: XXXXXXXX,
	env: process.env.NODE_ENV
    // other options
})
```
___

```javascript
// your code
this.$metrika.hit(path)
```

#### Options:

| Name           | Description                                                                                             | Required | Default                                                    |
| -------------- | ------------------------------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------- |
| id             | Your tracking `id`                                                                                      | True     | null                                                       |
| router         | [Autotracking](#autotracking) if the `router` is passed, otherwise: [manual tracking](#manual-tracking) | False    | null                                                       |
| env            | API calls are performed only if `env` is "production"                                                   | False    | development                                                |
| scriptSrc      | Src of metrika script to use                                                                            | False    | https://mc.yandex.ru/metrika/tag.js                        |
| debug          | If `env` is not "production" and `debug` is true: API calls are replaced by `console.log()`             | False    | false                                                      |
| ignoreRoutes   | List of ignored routes names                                                                            | False    | []                                                         |
| skipSamePath   | Do not track a page visit if previous and next routes URLs match                                        | False    | true                                                       |
| options        | Original Yandex Metrika [options](https://yandex.ru/support/metrika/code/counter-initialize.html)       | False    | {clickmap:true, trackLinks:true, accurateTrackBounce:true} |

[Yandex Metrika]: https://metrika.yandex.ru
[yarn]: https://yarnpkg.com
[npm]: https://npmjs.com
[Metrika API]: https://yandex.ru/support/metrika/objects/method-reference.html

---
_Source: https://npm.io/package/vue3-yandex-metrika · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
