L
L
latipov_no_12016-12-04 17:22:27
JavaScript
latipov_no_1, 2016-12-04 17:22:27

How to set up a goal script in Ya.Metrika and Google Analytics?

Good day!
I found a script on the Internet, I can’t get it to work, because. I don't know js.
//Goals for Yandex.Metrica and Google Analytics
$(".button").on("click", (function() {
ga("send", "event", "goal", "goal");
yaCounterXXXXXXXX. reachGoal("goal");
return true;
}));
HTML:
< div class="button_wrap">
< button class="button">Order < /button>
div>
XXXXXXXX is the goal counter
- goal identifier.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
be_a_man, 2016-12-04
@latipov_no_1

XXXXXXXX - replace with your counter number.
In the metric, write down the goal with the identifier goal.
What doesn't work?
UPD
And put the counters on the page yourself)

V
Valery, 2017-04-02
@ddimonn8080

A little strange - but you can dig. The double brackets here confuse me a little :

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question