Answer the question
In order to leave comments, you need to log in
Why doesn't ga work in ajax?
I created a goal in GA
I write in ajax form submission:
$.ajax({
url: "/frmVopros.php",
data: {
name: $(".f").val(),
phone: $(".fп2").val(),
vopros: $(".fo3").val(),
cururl: document.location.href,
title: document.title
},
type: "GET",
success: function(t) {
console.log( "Request Succied" );
ga('send', 'event', 'submit', 'btn');
window.location.href = "?ok";
, and instead of an event put a transition to the address, then it works .... maybe the Guru will tell you what's wrong?
Answer the question
In order to leave comments, you need to log in
To begin with, the code must be brought to the proper form. even if he falls.
$.ajax({
url: "/frmVopros.php",
data: {
name: $(".f").val(),
phone: $(".fп2").val(),
vopros: $(".fo3").val(),
cururl: document.location.href,
title: document.title
},
type: "GET",
success: function (t) {
console.log("Request Succied");
ga('send', 'event', 'submit', 'btn');
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question