Nit-Picking Magistrate

    @bchteam/vue-yandex-metrika

    1.0.2 • Public • Published

    @bchteam/vue-yandex-metrika

    @bchteam/vue-yandex-metrika allows you to send data about visited pages to Yandex Metrika.

    Installation

    Install with npm:

    $ npm i -S @bchteam/vue-yandex-metrika

    Ways to use

    Autotracking

    Pass the VueRouter 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 router is passed, otherwise: manual tracking False null
    env API calls are performed only if env is "production" False development
    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
    onInit(metrika, config) Function called when Yandex metrika loaded and ready to use. Passed 'config' is final used config False null
    onFail(error) Function called when error occurred during loading Yandex Metrika script or its initialization. False null
    options Original Yandex Metrika options False {clickmap:true, trackLinks:true, accurateTrackBounce:true}

    Keywords

    none

    Install

    npm i @bchteam/vue-yandex-metrika

    DownloadsWeekly Downloads

    10

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    36.5 kB

    Total Files

    5

    Last publish

    Collaborators

    • zakhse