How to configure goal metrics "event"?

Hello!
I can not understand how to configure goal metrics for the event. I have a button request callback from the pop-up form. I want to set the goal of not pressing the button after which the window POPs up.
In the settings of the metrics recommended to put the code onclick="yaCounterХХХХХХ.reachGoal('otp'); return true; but I already have onclick here which I understand causes the form. What to do?
Thank you all.
September 26th 19 at 07:24
3 answers
September 26th 19 at 07:26
Solution
copy here the piece of code button, we will specifically indicate how to register.
no, apparently you have to already have arcticmodal return - Mylene38 commented on September 26th 19 at 07:38
OS thank you Oh thank you!!! All poluchilos!!!! - percy.Bau commented on September 26th 19 at 07:41
input style="width:300px; margin-top:300px" type="button" id="send22" name="send222" onClick="$('#call-request').arcticmodal()" value="apply" - percy.Bau commented on September 26th 19 at 07:29
<input style="width:300px; margin-top:300px" type="button" id="send22" name="send222" onclick="yaCounterХХХХХХ.reachGoal('otp'); $('#call-request').arcticmodal();" value="apply">

of course XXXXXX is the number of your counter - Mylene38 commented on September 26th 19 at 07:32
and return true; not necessary? - percy.Bau commented on September 26th 19 at 07:35
Could you help me with a similar issue How to add a goal to an event in Yandex metric and google analytics? - Lionel commented on September 26th 19 at 07:44
We need Your help here too! How to set event purpose in Yandex metric? Thanks in advance! - virginia12 commented on September 26th 19 at 07:47
September 26th 19 at 07:28
add to existing onclick, this code yaCounterХХХХХХ.reachGoal('otp'); return true;
I tried that but probably the syntax is not correctly written - percy.Bau commented on September 26th 19 at 07:31
September 26th 19 at 07:30
Main thing is to have a single return at the end of the attribute value, and all calls were divided ;
Or to an existing onclick function to add reachGoal. - percy.Bau commented on September 26th 19 at 07:33

Find more questions by tags JavaScriptYandex.DirectYandex.Metrica