Skip to content

Instantly share code, notes, and snippets.

@kylewest
Last active July 19, 2016 18:40
Show Gist options
  • Save kylewest/dfdf3e4deb2ef0b165c28c72f1ec3f9e to your computer and use it in GitHub Desktop.
Save kylewest/dfdf3e4deb2ef0b165c28c72f1ec3f9e to your computer and use it in GitHub Desktop.
fire google analytics event when user clicks add to cart
<script type="text/javascript">
$(document).ready(function(){
$(".addtocartbutton").click(function() {
// GA events.js code here
ga('send', 'event', 'Videos', 'play', 'Fall Campaign');
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment