B
B
black hawk2016-07-14 14:07:36
CMS
black hawk, 2016-07-14 14:07:36

Inserting the Yandex Metrics goal ID l Website on Bitrix?

Good afternoon experts and smart people!
Please tell me how the reachGoal metric identifier is inserted on the Bitrix website
For example:
There is a "Request a call" form and according to the Yandex instructions, you must write:

<form action="/" id="new_callback_form" onsubmit="yaCounterXXXXXX.reachGoal('CALL_BACK'); return true;” class=" new_callback_form"="">

But in this case, the goal does not work. Below, in this form, is the code:
<div class="submit">
      <button onclick="button_callback('/bitrix/components/altop/callback', '[email protected]', 'NAME/TEL/TIME');" type="button" name="send_button" class="btn_buy popdef">Заказать</button>
    </div>

The conclusion suggests itself that you need to put on the button onclick="yaCounterXXXXXX.reachGoal('CALL_BACK'); return true;"
but then what about the form fields if the user clicked Order without filling in the fields.
The second problem, due to the confusion with pop-up windows, forms and a bunch of buttons in them.
In the product catalog, click on the "Add to cart" button - the product goes to the cart and a pop-up modal pops up in which there are a lot of divs and a form with the
"Continue"
"Checkout" buttons
below the code:
...
<form action="/personal/cart/" method="post">
                <button name="order" class="btn_buy popdef order" onclick="yaCounterXXXXXX.reachGoal('CHECKOUT'); return true;" value="Оформить заказ">Оформить заказ</button>
              </form>
...

Everything worked for a week and suddenly, for the purposes of the Order Confirmation (reachGoal('CHECKOUT')) disappeared
Is it due to the fact that it costs onclick on the button, and not onsubmit on the entire form
Thank you in advance for the answers and I will be immensely grateful if an experienced person, tell you how to put these identifiers in the Bitrix CMS (always worked only on self-written ones)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shtinov, 2016-07-22
@delimer

1) Tracking the addition to the cart is best hung in the addToCart function (somewhere in the java scripts of the template, like).
2) To track the order, it is best to hang on the "Order completed" page in this form:

<script>
yaCounterXXXXXX.reachGoal('CHECKOUT');
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question