Created
September 24, 2012 21:20
-
-
Save kressaty/3778455 to your computer and use it in GitHub Desktop.
Track Form Abandonment in Google 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
// NOTE: this assumes you have loaded jQuery | |
$(document).ready(function() { | |
// REPLACE 'UNIQUE_FORM_ID' BELOW WITH THE ID OF YOUR FORM | |
$('#UNIQUE_FORM_ID input').blur(function () { | |
if($(this).val().length > 0) { | |
_gaq.push(['_trackEvent', 'Form: FORM NAME HERE','input_exit_full', $(this).attr('name')]); | |
} | |
else { | |
_gaq.push(['_trackEvent', 'Form: FORM NAME HERE','input_exit_empty', $(this).attr('name')]); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment