Answer the question
In order to leave comments, you need to log in
Why might the Google Analytics goal fail in jQuery code?
Passing form field values to pnp works through a jQuery script, it passes the field values to a php file, then updates the value of all form fields and pops up a successful submission notification.
In jQuery, immediately after sending the field values to php, the Yandex Metrics and Google Analytics goals must also be fulfilled.
The TARGET goal in Yandex Metrica is marked as completed, but Google Analytics does not see the goal being completed.
Tell me why Analytics can not see the achievement of the goal?
$(document).ready(function() {
//E-mail Ajax Send
$("form").submit(function() {
var th = $(this);
$.ajax({
type: "POST",
url: "php/mail.php",
data: th.serialize(),
success: function(data) {
th.parent().find(' input[type=text], input[type=tel], input[type=email], textarea').val('');
ym(XXXXXXXX, 'reachGoal', 'TARGET');
ga('send', 'event', 'submit', 'TARGET');
}
}).done(function() {
$(".form_info").addClass("form-info-open");
setTimeout(function() {
// Done Functions
th.trigger("reset");
}, 1000);
setTimeout(function(){
$('.form_info').removeClass('form-info-open');
}, 10000)
});
return false;
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question