Answer the question
In order to leave comments, you need to log in
How to add different targets to one element?
Good day to all!
The situation is this: the site has two "Request a call" buttons, one in the header, the other in the footer. Both of them call the same modal window with a form for filling in contact data. The form has a submit button. Here on this button I need to hang a target for Yandex metrics.
But bad luck: I need to create a target indicating that this form was sent by a call from the header, another target - from the footer. How to implement it?
I understand that you need to create a compound goal, but on the "Submit" button, I can hang only one code in OnClick
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
So if you make a compound goal, you get
goal 1
- footer
button - send button
goal 2
- header
button - send button
When you click on the button in the footer and then send, goal 1 will be reached, but goal 2 will not.
On a button in the footer onclick="yaCounterXXX.reachGoal('clickButtonFooter'); return true;"
On button in header onclick="yaCounterXXX.reachGoal('clickButtonHeader'); return true;"
Well, send the button onclick="yaCounterXXX.reachGoal('clickButtonSubmit'); return true;"
Make a global variable, in which, when processing a click on the links at the bottom or at the top, write down the ID of the goal of the metric. Accordingly, insert the value of this variable into ym.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question