A
A
Alexander Arbuzov2017-05-31 12:44:30
JavaScript
Alexander Arbuzov, 2017-05-31 12:44:30

Why might yaCounter not work?

There is an add to cart button. It is available in several versions on the site, and in order not to produce a code, a single function for adding goods to the cart is written. A handler is attached to all possible button classes. Everything looks like this:

$(document).on('click','.className1, .className2',function(){
<Тут код ajax добавления товара в корзину>
yaCounterXXXXXX.reachGoal('addToCart');
})


So js does not know any yaCounter. typeof returns 'undefined'
How to overcome?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dark Hole, 2017-05-31
@arbuzzz

Open the console and write yaCounter there. Let's see what the browser offers. Nothing means nothing has loaded at all. If something is a typo.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question