[How to] Monitor click events with Analytics.js

Ok, so this is not strictly a Joomla tip and trick - but if you are using Joomla with the new Google Universal Analytics, you might want to create track events which are happening by your users on various parts of you website. One of the things we've been trying to do is implement a number of goals on our sites. This way we can truly monitor user interaction on various elements of our website. In this case, since we are using click events to open specific parts of our website, we wanted to make sure that we know when a user is clicking on a specific part of the site (let's say for the sake of example, we want to know how many times users are clicking on the "Plans & Pricing" page). 

 

Since it wasn't easy for us to find the way to do this with the new Google Analytics, or analytics.js, once we actually got it to work, we decided to make this another Joomla tip.

So want you need to do is send an event via the ga function to the analytics.js. If you want to do this on the onclick event, you just pump these values into an onclick event

<a href="#" onClick="ga('send', 'event', 'Clicks', 'Testing', 'Test Event');">Plans & Pricing</a>
  • Clicks is our category (you can use the category to group categories of events, such as Downloads let's say, or in our case the generic "Clicks"
  • Testing is our action (you can define any action you want here too)
  • Test Event is the label in our case 

Once you have successfuly implemented this code within the HTML of your Joomla article, or wherever you want to monitor, you should now setup a goal which monitors for this specific event.

The goal type should be an Event, rather than a Destination, Duration, or Pages per Session.

Creating-an-Event-Goal-in-Analytics.js

Once you've inserted the code and created the Event Goal, you can test this immediately via the Real-Time > Events. The more clicks you click, the more events you will see coming up! See the 2nd screenshot below.

NB: This tip only works if you are using the new Google Universal Analytics (analytics.js)

 

Event-Goal-in-Real-Time-Events-in-Google-Analytics

One more thing...

Do you have friends or a Facebook group who you think would find this useful? Share this with them and then let me know what they think.

Want to supercharge your website?

 
Our website loads FAST ... just 1.29 seconds. We're hosted on FAST InMotion VPS servers We want YOUR website to be fast too, so we've gotten you an exclusive deal - 47% OFF for DART Creations friends + FREE domain! Check it out NOW!
 

Translate

who are we?

DART Creations is run by David Attard - working in and around the web design niche for more than 12 years, we provide actionable tips for people who work with and on websites. We also run DronesBuy.net - a website for drone hobbyists

David attard

Follow us on Social

         

 

 

 

Popular Content

Joomla extensions to take your website to the NEXT level

Is your Joomla website reaching its full potential? We install many of these extensions on almost ALL of our Joomla sites - why don't you check them out our list of Joomla Extensions and see whether you can take your site to the next level?

Where are we hosted?

This site is proudly powered by FAST VPS InMotion Servers and given an insane speed thanks to MaxCDN!

Web Hosting MaxCDN - Speed up your website

 

InMotion Hosting Review - Recommended Web Hosting servers for business, Joomla, WordPress and ecommerce websites.

InMotion Hosting Review

Advertise on DART-Creations.com

DART Creations is interested in developing partnerships with mutual benefit. If you like the stuff we publish and would like to develop a relationship, we'd be happy to hear from you. Go on - drop us a line - we'd love to hear from you :-)

The Outstanding HunGRYJPEG Bundles

AWESOMENESS! Bundles of premium font + graphic packs at more than 96% OFF!  Get this bundle for just $29 - This month ONLY!

The Hungry JPEG Awesome font bundles

New! DIVI 3.0 WordPress TeMPLATE + PageBuilder - 10% OFF Limited Launch offer

You'll surely create a perfect website with Divi 3.0!

Divi 3