M
M
maxzag2017-11-30 17:50:27
Google Analytics
maxzag, 2017-11-30 17:50:27

Goals for the Google Analytics form and Yandex Metrica?

Good afternoon,
There is a feedback form with ajax sending, I hung the onsubmit attribute on the form tag in which I added functions for sending metrics and Google analytics, and the problem is that the data leaves even if the form is empty, although I registered validation in ajax.

https://jsfiddle.net/wnr2at9u/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tyzberd, 2017-11-30
@maxzag

you need to add not to onsubmit but to the code where the response from ajax comes.

$.ajax({
  method: "POST",
  url: "some.php",
  data: { name: "John", location: "Boston" }
})
  .done(function( msg ) {
    код аналитики
  });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question