Skip to content

Instantly share code, notes, and snippets.

@Shoora
Forked from andregoncalves/form-submit-tracking-1.js
Last active February 28, 2019 03:38
Show Gist options
  • Save Shoora/6ed0434bb5b584846ac8 to your computer and use it in GitHub Desktop.
Save Shoora/6ed0434bb5b584846ac8 to your computer and use it in GitHub Desktop.
form-submit-tracking-1
$("form").on('submit', function(e) {
var form = this;
if (_gaq) {
e.preventDefault();
_gaq.push(['_trackEvent', 'my category', 'my action']);
setTimeout(function() { form.submit(); }, 100);
return false;
}
return true;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment