Answer the question
In order to leave comments, you need to log in
How to add onclick to DIV via JS for Yandex Metrics?
Hello. Tell me, you need to wrap the ad block from AdSense in a DIV and hang a goal on click on this DIV (as I understand it, an event)
Will this work?
<div class="test" onclick="ym(XXXXXX, 'reachGoal', 'TARGET_NAME'); return true;" ></div>
Answer the question
In order to leave comments, you need to log in
The click will work on the ad, not the wrapper. You need to click on the advertisement to look for a wrapper. For example, through closest()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question