X
X
XXR2020-06-20 15:01:46
JavaScript
XXR, 2020-06-20 15:01:46

Where to integrate metrics?

Hello everyone, I got someone else's site and I need to integrate the metric there, I figured out where to integrate in html, but where and how in js I don't understand, tell me what to know in the future how to do it, thanks
yaCounter64463707.reachGoal("click_tel") - - where is this
yaCounter64463707.reachGoal("send_form") -- and this is ???

вот код в js файле 
$("#form,#form_sub,#form_last,#form-title,#form-next").submit(function() {
    $.ajax({
        type: "POST",
        url: "mail.php",
        data: $(this).serialize(),

        success: function() {
            var successMessage = $(".successMessage");
            var popup = $('.popup');
            $('.modal-backdrop').removeClass('hide'); // закрываем модальный элемент


            popup.fadeIn(400);
            successMessage.fadeIn(400);
            popup.delay(2000).fadeOut(400);


            // $(this).find("input").val("");
            // //    $(this).find("textarea").val("");
            // $(this).find("select option:selected").val("");
            // //    $(this).find("input:checkbox:checked").val("");    
            // $(".form ,.form_sub").trigger("reset");
        },
        error: function() {
            $('.modal-backdrop').removeClass('hide'); // закрываем модальный элемент





            var errorMessage = $(".errorMessage");
            var popup = $('.popup');
            popup.fadeIn(400);
            errorMessage.fadeIn(400);
            popup.delay(2000).fadeOut(400);
        }
    })
    return false;
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy Pershin, 2020-06-20
@XXR

In the success: function() { block, you can insert yaCounter64463707.reachGoal("send_form") if the event of a successful send is implied
But the phone is not clear. You can add an onclick event to the button you want to watch:

<a href="#" onclick='yaCounter64463707.reachGoal("click_tel")'>ссылка</a>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question