Created
July 19, 2016 18:05
-
-
Save thelinuxlich/5fc06f6bf972c24ac18a2a78757ec32b to your computer and use it in GitHub Desktop.
Form Submit with delay for Analytics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#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