D
D
Denis Shishkin2017-03-12 12:52:25
Yandex
Denis Shishkin, 2017-03-12 12:52:25

How to correctly add a goal to the Yandex Metrics link?

There is a link like this:

<a class="vp-a" href="https://www.youtube.com/video"><img src="http://mysite.com/wp-content/uploads/2017/02/video-1.png" /></a>

I created a target java script event, and I insert it as shown here , it comes out like this:
<a class="vp-a" href="https://www.youtube.com/video"  onclick="yaCounterXXXXXX.reachGoal('ORDER'); return true;"><img src="http://mysite.com/wp-content/uploads/2017/02/video-1.png" /></a>

It is clear that I substitute my data from the metric. But the problem is that apparently you need to somehow write the metric code in the link differently, tell me who knows.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel, 2017-03-12
@DeniSShishkin

All right, what exactly is not working for you?
Add a parameter _ym_debug=1to your request and check if the target fires in the console ( more info )

J
Jacob, 2017-03-13
@Logrise

By default, the metric tracks clicks on external links, you don't even need to hang up an event. If the goal is to create by url, then the conversion will also be counted.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question