Mobile app version of vmapp.org
Login or Join
Sent6035632

: Event Tracking in Universal Analytics I'm using Universal Analytics tracking code and would like to start tracking click events for one of the buttons. I added the ga('send'...) on click event

@Sent6035632

Posted in: #EventTracking #GoogleAnalytics #UniversalAnalytics

I'm using Universal Analytics tracking code and would like to start tracking click events for one of the buttons. I added the ga('send'...) on click event via jQuery. Do I need to make any changes to the actual Universal Analytics tracking snippet?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent6035632

2 Comments

Sorted by latest first Latest Oldest Best

 

@Shanna517

No you don't. Google mentions that the events tracking is part of analytics.js (which is what the default Universal Analytics snippet is calling).

I'm sure you already saw this, but in case you didn't and you're wanting to confirm that you did the jQuery part correctly, here's Google's example.

10% popularity Vote Up Vote Down


 

@Heady270

No, you don't need to make any changes. I'm assuming you are invoking the library and creating the tracker through the standard method.

Your code should look something like this:

<button onclick="ga('send', 'event', 'your_category', 'your_action', 'your_label');">


With jQuery, placing an event listener on the button:

$('button').click(function(){
console.log("sending your event"); // use this to debug
ga('send', 'event', 'your_category', 'your_action', 'your_label');
}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme