Skip to content

Instantly share code, notes, and snippets.

@johnzuh
Forked from chrisjimallen/gist:6245322
Created January 27, 2014 21:02
Show Gist options
  • Save johnzuh/8657243 to your computer and use it in GitHub Desktop.
Save johnzuh/8657243 to your computer and use it in GitHub Desktop.
jQuery(document).ready(function($){
$('form').submit(function(event){
//if analytics object exists
if(window._gat){
event.preventDefault();
optinForm = this;
_gaq.push(['_set','hitCallback', function(){
optinForm.submit();
}]);
_gaq.push(['_trackEvent', 'Forms', 'Submit', 'hbsanewtraffic']);
}
//if no analytics object, service as normal
});
});
@johnzuh
Copy link
Author

johnzuh commented Jan 27, 2014

Great resource. will test it for my forms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment