Skip to content

Tracking Events

You can track certain events, such as when someone clicks on a link on your website, by adding in a small piece of code on the page.

Please note: This is an advanced feature and a normal site report won't show you this information. Advanced users who would like to set up this tracking will also need to contact the Web Team to set up an event tracking report for your website.

Setting up the Tracking Code

The good news is that you now no longer need to setup tracking code on your pages! We have setup 'auto analytics' and are able to track clicks on links within the page based on the text that is linked and the title or file type that's linked to. To ensure you get the most out of the tracking code, please ensure you do the following:

  • name your documents appropriately
  • link on meaningful words not 'click here' or 'download'
  • use appropriate element id's (this is done via the code) on things such as accordions, tabs and quicklinks
  • use appropriate alt tags and titles if you're using them

Can I Still Use Google's Tracking Code?

If you wish to still use the tracking code supplied by Google, the code that you should use is:

onClick="ga('send', 'event', 'Category', 'Action', 'Label');"

Then you can track specific events and still have control over the category names etc. which can be useful if you want to group things together in a more refined report that doesn't contain all of the autoanalytics data which can be rather large.

  • Instructions for Setting up the Tracking Code

    To setup the tracking code for a link on your website, you will need to edit the page and go into the HTML view.

    Once in the HTML view, find the link that you want to track the numbers of clicks it receives, e.g.:

    <a href="http://www.facebook.com/uniofadelaide">Adelaide University Facebook page</a>

    Once you have found the link, you will need to add in the tracking code in between the " and the > after the link URL by pressing spacebar and adding the tracking code in thereafter. E.g.:

    <a href="http://www.facebook.com/uniofadelaide" onClick="ga('send', 'event', 'Homepage', 'Icon', 'Facebook');">Adelaide University Facebook page</a>

    The tracking code by itself looks like this:

    onClick="ga('send', 'event', 'Category', 'Action', 'Label');"

    where you specify a category, sub-category (action) and value that will allow you to identify what is being tracked in the report. For the example used above, the tracking code could be:

    onClick="ga('send', 'event', 'University Homepage', 'Icon', 'Facebook');"

    Understanding The Tracking Code

    Category

    The first word in the above example code is 'Homepage', this is the category. You can have multiple tracking events using the same category. The category signifies the "root level" of the hierarchical structure of the Event Tracking.

    You should use the name of your website or the text used in the URL for your homepage, e.g. for www.adelaide.edu.au/environment/ you would use 'Environment Institute' as your 'Homepage' text.

    Do not use 'Homepage' as your category. That would symbolise the Universities Homepage in the bigger scheme of things.

    Action

    The second word in the above code is 'Icon', this is the action in Google Analytics terms. Basically, this is the subcategory. It can be useful to use the type of item being tracked, and as it is an Icon image in the example, we have called it 'Icon'.

    Value

    Finally, the third word in the above code is 'facebook', this is the value. This defines the specific link and lets you know when you receive the analytics report what link it was. In the above example it was the facebook link.

    Examples

    If you had a pdf that you wanted to track you could do the following:

    onClick="ga('send', 'event', 'Your site name', 'pdf', 'corporate brochure');"

    Or if it were a button:

    onClick="ga('send', 'event', 'Your site name', 'button', 'register');"

Viewing Event Tracking Reports

If you have access to a profile setup for your website in Google Analytics you can view the events being captured by going to: Google Analytics dashboard > real-time > events OR Google Analytics dashboard > Behaviour > Events > Overview and looking at the Event Label.

The following identifiers are used in the linear order in which they are listed :

  • # ( element id)
  • % ( title of element )
  • = ( text inside element )
  • $ ( first image with an alt tag that is a child of the element )
  • . ( class name(s) of the element)
  • ... ( the path (parents of the element until a suitable identifier is found) )

Events are grouped into categories. The following categories and the related actions are currently described:

  • link
  • click:host-external
  • click:host-internal
  • ui-link ( a tags that aren't links to pages)
  • click:page-ui
  • ui-page-link ( a tags that link to content on the page ( ids ) )
  • button
  • ui-form-textarea
  • ui-form-text
  • ui-form-checkbox
  • ui-form-submit
  • ui-form-radio-button
 

Web Team

Call us: For urgent requests or to speak with someone directly,
please contact one of our team members.
 
Not sure how to do something? Take a look at our FAQs.