Google analytics classic
jQuery(".form").on("submit", function(f) {
var _this = this;
_gaq.push(['_set','hitCallback',function() {
$(_this).parents('form').first().submit();
}]);
_gaq.push(['_trackEvent', '/signup']);
// here is check if google-analytics.js is loaded and if not - return true, otherwise false
return !window._gat;
})
Google analytics universal
jQuery(".form").on("submit", function(f) {
var _this = this;
ga('send', 'pageview', '/signup', {
'hitCallback': function() {
$(_this).parents('form').first().submit();
}
})
// here is check if google-analytics.js is loaded and if not - return true, otherwise false
return !(ga.hasOwnProperty('loaded') && ga.loaded === true);
})