I'd like to add event tracking to my website using Google Analytics but I can't seem to get any data. I'm trying to capture button click events. Here is my jQuery code:
<script>
$(document).ready(function () {
$("input[type='submit'][value='Sign Up']").on('click', function () {
alert("Test.");
ga('send', 'event', 'amazon', 'item', 'topreviewbutton');
});
});
</script>
For some reason I'm not pulling in any data (but my alert is going off so I know the code is running). Does anybody have any tips for troubleshooting/setting up event tracking? Also, I get an error that says:
Uncaught ReferenceError: ga is not defined
when I click the button. Is adding the UA - XXXX - ID in the correct section in SquareSpace not sufficient for event tracking? Should I copy and paste their universal analytics javascript code instead? Am I missing a library?