/stat-counters

The lib provides statistics counters, e.g. Google analytics, Yandex metrica, etc

Statistics counters BEM-library

The library provides site statistics counters to use in BEM-based project.

Blocks inside

  • Yandex-metrica
  • Google-analytics (in progress)

How to use

  1. Get the library
$ bower install bem-stat-counters --save
  1. Include the library to levels declaration in your compiler tool config (e.g. enb, bem-tools)

enb example

function getLevels(config) {
    return [
        // vendors levels
        {
            path: 'vendors/stat-counters',
            check: false
        },
        // your own levels
    ].map(function(levelPath) { return config.resolvePath(levelPath); });
}

bem-tools example

// TODO
  1. Declare any library block in your bemjson
{
    block: 'footer',
    content: [
        // smth content,
        {
            block: 'yandex-metrica',
            params: {
                id: configs.metrika.id,
                webvisor: true,
                clickmap: true,
                trackLinks: true,
                accurateTrackBounce: true
            }
        }
    ]
}

How to declare blocks

Yandex metrica

Block has one required param id and other optional params, see example below

 {
    block: 'yandex-metrica',
    params: {
        id: configs.metrika.id, // required param
        webvisor: true,
        clickmap: true,
        trackLinks: true,
        accurateTrackBounce: true
    }
}