Skip to content

Instantly share code, notes, and snippets.

@TorbenL
Created June 14, 2013 07:33
Show Gist options
  • Save TorbenL/5780114 to your computer and use it in GitHub Desktop.
Save TorbenL/5780114 to your computer and use it in GitHub Desktop.
tracking conversion of ajax form with google analytics
$(function(){
$("form").on("submit", function(e){
e.preventDefault();
$.post('ajax.php', {
data: $("form").serialize()
}, function(result) {
if(!result.ok)
return false;
_gaq.push(['_trackPageview', '/contact-submitted']);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment