The even code looks like this:
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
Let’s test it.
Test Link – This link goes no where. But it does send an event to Google Analytics and I know exactly how many times it gets clicked.
Before adding the code:
<a href="#">Test Link</a>
After adding the code:
<a href="#" onclick="ga('send','event','link clicked','Test Link Clicked',this.href);">Test Link</a>
Then you can go into Google Analytics and watch in wide wonder as the clicks roll in. The easiest way is to open Real-Time > Events: