Shoora
3/12/2013 - 6:32 AM

Optimized Yandex Metrika script

Optimized Yandex Metrika script

(function (d, w, c, t) {
    (w[c] = w[c] || []).push(function() {
        try {
            w.yaCounterXXXXXXX = new Ya.Metrika({id:XXXXXXX,
                    webvisor:true,
                    clickmap:true,
                    trackLinks:true,
                    accurateTrackBounce:true});
        } catch(e) { }
    });

    var y = d.createElement(t),
        s = d.getElementsByTagName(t)[0],
        f = function () { s.parentNode.insertBefore(y,s); };
    y.src = '//mc.yandex.ru/metrika/watch.js';

    if (w.opera == '[object Opera]') {
        d.addEventListener('DOMContentLoaded', f, false);
    } else { f(); }
})(document, window, 'yandex_metrika_callbacks', 'script');