Answer the question
In order to leave comments, you need to log in
How to get the ClientID of Yandex.Metrica?
Hello!
Can you tell me how to use this method?
https://yandex.ru/support/metrika/objects/get-clie...
I try corny like this - the error "yaCounter99999 is not defined"
<script type="text/javascript">
var clientid = yaCounter99999.getClientID();
console.log(clientid);
</script>
Answer the question
In order to leave comments, you need to log in
Try like this
<script type="text/javascript">
window.onload = function(){
var clientid = yaCounter99999.getClientID();
console.log(clientid);
}
</script>
initialize the counter
first
List of fields that can be defined in settings - on the same page
alternatively you can use:
function GetYMCID() {
var match = document.cookie.match('(?:^|;)\\s*_ym_uid=([^;]*)');
return (match) ? decodeURIComponent(match[1]) : false;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question