H
H
heavig22016-06-02 23:52:27
Yandex.Metrica
heavig2, 2016-06-02 23:52:27

How to set up Metrica goals when submitting a form?

Hello!
there is a form

<form method="post" id="inlineForm" action="sender.php" onsubmit="yaCounter32798110.reachGoal('callmec'); return true;">
      <p class="form-title">Перезвоните мне</p>
      <input class="txt-name" name="name"   type="text"  placeholder="Введите Ваше имя" >
      <input id="phone4" class="txt-phone" name="phone"  type="text" placeholder="Введите Ваш телефон">
      <input type="hidden" name="whatForm" value="Заказать звонок">
      <input class="btn" name="send" type="submit" value="Заказать звонок">
    </form>

But the goal is triggered simply by clicking on the "Request a call" button. How can I make it work only when the form is submitted?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Denisov, 2016-06-03
@DeoZ

Sew the js-code reachGoal into the form handler at the moment when the actual submission occurs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question