Answer the question
In order to leave comments, you need to log in
How to add Yandex metrics goals to buttons created through the native WP constructor?
Friends, there is a Wordpress site with a native theme. Buttons are created through the constructor; there is no option to add an event simply to the html. Is there a js way to add an onclick event?
Answer the question
In order to leave comments, you need to log in
$(".element_class").on('click', function(){
yaCounterXXXXXX.reachGoal('TARGET_NAME');
return true;
});
Yandex shortened its code a little: now it’s more relevant like this:
$(".element_class").on('click', function(){
ym(XXXXXXXX,'reachGoal','TARGET_NAME');
return true;
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question