Answer the question
In order to leave comments, you need to log in
How to get Yandex Metrica counter id?
How to get the id-counter of Yandex Metrica installed on the site using js?
Answer the question
In order to leave comments, you need to log in
var id = Ya.Metrika.counters()[0].id;
Pokovyryal, it turns out there is an array of counters.
ID of the counter on the site with enabled webvisor:
var id = Ya.Metrika.counters().filter(x => x.webvisor)[0].id;
not normally.
for(var i in window){
if(new RegExp(/yaCounter/).test(i)){
console.log(i);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question