The University of Northern Colorado has recently embraced all things analytics and as part of that we had a need to add event tracking code to buttons. The best use of this is when a pdf or document needs to be tracked. Since that content can’t have the analytics code, the link to it can fire an event that can be tracked in Google Analytics.

Preview of the Gadget

The Google Event Tracking Gadget will help web contributors create event tracking codes on links.

This gadget works with the most recent version of Google Analytics, or analytics.js. Full documentation about events can be found within Google’s Event Tracking Documentation.

The final code that is produced by the gadget is this:

Test to see if it worked

Publish the file with OU Campus and click on the link. Next, login to Google Analytics and open up a view that is part of that page. On the right column select “Real-Time” / “Events”. The current events happening on the site will be displayed. It usually takes a few seconds for an event to show up.

Item #3 below is the event that was fired when the link from the code above was clicked on.

Event Overview

Clicking into the row will show the Event Label, which in this case was “Jesse”

Event Detail

The Gadget

The code for the gadget is up on GitHub or if you would like to install it via GitHub Pages, follow OmniUpdate’s Instructions for installing a gadget, when asked for the URL use: