X
X
xaruki2020-09-07 13:57:59
JavaScript
xaruki, 2020-09-07 13:57:59

How to set up metric targets with one popup?

Good afternoon experts.

There is an html site with services. There is one form in the pop-up window, which is called by clicking on "Order a service".
There is one pop-up window, but there are many services. How to set goals for at least a click, so as not to create a pop-up window with a form for each service?

Thanks for the help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danny Arty, 2020-09-07
@xaruki

It turns out that for each service you have your own button Order a service , but at the same time one form in the pop-up?
Then you can set up multiple goals in Yandex.Metrica.
Goal-1 "Button click" : Create a separate javascript event for each button and add to the button code:

onclick="ym(XXXXXX, 'reachGoal', 'USLUGA-1'); return true;"

for example, for a button to Service-1 and, accordingly, for Service-2 it will be:
onclick="ym(XXXXXX, 'reachGoal', 'USLUGA-2'); return true;"

Goal-2 "Form Submission" : Also create an event for submitting the form and add a line like this to the form code:
onsubmit="ym(XXXXXX, 'reachGoal', 'TARGET_NAME'); return true;"

Learn more about compound goals here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question