Skip to Content

Universal Analytics Event Tracking Setup Instructions

[Google]
Summary: Google Analytics has begun the forced upgrade to Universal Analytics, so it's time to update your code, including any custom event tracking you have set up for key performance indicators (KPIs) you monitor on your site. Don't be intimidated by the length and detail of this post, setup should take you only minutes. A few weeks back I posted a tutorial on setting up event tracking through "classic" Google Analytics and promised to provide the updated instructions for users who've upgraded to Universal Analytics. Well, after having also recently posted a tutorial for upgrading to Universal GA, it seems like the perfect time to show you the new way to set up event tracking. While GA should continue working for the most part - even after the upgrade and before updating the code - there are no guarantees it'll work flawlessly forever, and given that Google recommends updating to the Universal code, we strongly recommend that you also adapt all other aspects of your GA tracking as well, including event tracking. Looking at the Universal GA event tracking developer documentation it became clear that Google had drastically altered their setup instructions in a technical way that is over my head. Given that he'd implemented Universal Analytics event tracking before, I consulted our Director of Development, Ben Glassman, for clarification. He explained that basically there are now better ways to set this up that are more adaptable to change, which is why they don't give the simple individual link tagging examples they did for classic GA. My head spun as Ben explained the exciting new ways we can use Javascript and jSon to dynamically tag our links (at least I think that's what he said), but in the end he confirmed that to track a single link click as an event, you could still set up the Universal Analytics equivalent of the old "classic" link tagging, which is all we're really talking about today - Simple event tracking setup for the non-technical marketing folks, like myself. For more advanced event tracking, requiring coding by a developer, contact us for assistance today.

Event Tracking URL Tagging

If you read my classic GA event tracking crash course, you'll recall that we were setting up tracking for clicks on an email address link, and tagged that link this way:
<a href=”mailto:hello@vtdesignworks.com” onClick=”_gaq.push(['_trackEvent', 'Email Address', 'Click', 'Privacy Policy',, false]);”>hello@vtdesignworks.com</a>
To modify for Universal GA, we simply had to replace everything in the onClick function  - _gaq.push(['_trackEvent', 'Email Address', 'Click', 'Privacy Policy',, false]); - with the following: ga('send', 'event', 'Email Address', 'Click', 'Privacy Policy'); You'll notice that the only change is structural - the optional and required values remain the same. As a refresher, here's how Google defines them:
Value Type Required Description
Category String Yes Typically the object that was interacted with (e.g. button)
Action String Yes The type of interaction (e.g. click)
Label String No Useful for categorizing events (e.g. nav buttons)
Value Number No Values must be non-negative. Useful to pass counts (e.g. 4 times)
At any rate, the complete tagged link, updated for Universal GA, looks like this:
<a href="mailto:helloREMOVETHISBEFORESENDING@vtdesignworks.com" onclick="ga('send', 'event', 'Email Address', 'Click', 'Privacy Policy');">helloREMOVETHISBEFORESENDING@vtdesignworks.com</a>
A subtle change, but one worth making to keep up with GA's latest changes and of course this is the way you'd want to set up events from the jump if this is your first time. Again, this is a good idea if you only have a handful of simple events to track on your site and limited access to coders, but if you need a more advanced, custom setup, talk to someone who knows what they're doing before getting yourself into trouble. And don't be intimidated by the length of this post - the setup should really only take a matter of minutes. Add a couple more minutes if you want to set up goal tracking to track your events as conversions. Goal tracking setup for events hasn't changed, but here again is a screenshot for how I set up the goal for the example event in this post: Event Goal Universal Google Analytics Once you've set up your events and goals, data will begin to flow into your GA reports under both the "Conversions" and "Events" areas, which I also showed you in the classic event tracking setup post, but here again are the screenshots in case you missed that post.

Real Time Analytics - Events

You can immediately see data populate the "Events" section of your Real Time GA reports: Real Time Events Universal Google Analytics ClicksReal Time Events Universal Google Analytics There is however a lag before data will appear in the main Events subsection under the Behavior tab, so you won't see anything there right away even if you test your own event. Give it a good 24 hours before you start panicking if you don't see data flowing. Events Overview Universal Google Analytics (Side note: If you're filtering traffic from your own IP address, which you should be doing, you'll have to be clever about testing. Either use a computer not on your network or simply make sure you're not using WiFi on your smartphone, clear your cache, and then complete the event action from your phone) As you adapt your event tracking to Universal GA, feel free to let us know how it goes in the comments below. We'd love to share any tips you have or issues you run into with our readers. And of course if you need any custom conversion tracking or online marketing services at all, feel free to contact us any time.