Skip to content

Instantly share code, notes, and snippets.

@thelinuxlich
Created July 19, 2016 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thelinuxlich/5fc06f6bf972c24ac18a2a78757ec32b to your computer and use it in GitHub Desktop.
Save thelinuxlich/5fc06f6bf972c24ac18a2a78757ec32b to your computer and use it in GitHub Desktop.
Form Submit with delay for Analytics
$('#form_id').submit(function(e) {
var form = this;
e.preventDefault(); // disable the default submit action
ax.identify(email);
$(':input', this).attr('disabled', true); // OPTIONAL: disable all elements in the form, to avoid multiple clicks
setTimeout(function() { // after 1 second, submit the form
form.submit();
}, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment