0.0.0-development • Published 6 years ago
vue-yandex-metrika-full-path v0.0.0-development
Vue Yandex Metrika
vue-yandex-metrika allows you to send data about visited pages to Yandex Metrika.
Installation
Install with yarn:
$ yarn add vue-yandex-metrikaInstall with npm:
$ npm install vue-yandex-metrika --saveWays to use
Autotracking
Pass theVueRouter instance to the plugin and let it handle everything for you (Metrika API is also available):
// your main.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import VueYandexMetrika from 'vue-yandex-metrika'                               
const router = new VueRouter({...}) // your routes
Vue.use(VueYandexMetrika, {
    id: XXXXXXXX,
    router: router,
    env: process.env.NODE_ENV
    // other options
})Manual tracking
Works without router: Metrika API
// your main.js
import Vue from 'vue'
import VueYandexMetrika from 'vue-yandex-metrika'                               
Vue.use(VueYandexMetrika, {
    id: XXXXXXXX,
    env: process.env.NODE_ENV
    // other options
})// your code
this.$metrika.hit(path)Options:
| Name | Description | Required | Default | 
|---|---|---|---|
| id | Your tracking id | True | null | 
| router | Autotracking if the routeris passed, otherwise: manual tracking | False | null | 
| env | API calls are performed only if envis "production" | False | development | 
| debug | If envis not "production" anddebugis true: API calls are replaced byconsole.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 | False | {clickmap:true, trackLinks:true, accurateTrackBounce:true} | 
0.0.0-development
6 years ago