Answer the question
In order to leave comments, you need to log in
How to connect Yandex.Metrica in RequireJS?
Colleagues, tell me how to load Yandex.Metrika in RequireJS ?
Answer the question
In order to leave comments, you need to log in
Just wondered about this too. I tried this, it seems to work:
1. in the HTML body, only
<noscript><div><img src="//mc.yandex.ru/watch/XXXXXX?ut=noindex" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
"yametrika": "//mc.yandex.ru/metrika/watch"
define([ 'backbone','jquery', ... ,"yametrika"], function(...){}
try {
window.yaCounterXXXXXX = new Ya.Metrika(
{
id:XXXXXX
, trackHash:true
, ut:"noindex"
}
);
} catch(e) { }
...
return {
addFileExtension:function(){}
, clickmap: function(){}
, enableAll: function(){}
, extLink: function(){}
, file: function(){}
, hit: function(){}
, replacePhones:function(){}
, notBounce: function(){}
, reachGoal: function(){}
, trackLinks: function(){}
, params: function(){}
};
requirejs.onError = function(err){
if( err.requireModules.length == 1 && err.requireModules[0] == "yametrika") { ... } else throw err;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question