We are using the new Google Analytics Universal code, but our event tracking code does not seam to be working. Any ideas on what is wrong? Thank you.
<a onclick="ga('send', 'event', 'link', 'click', 'label', {'hitCallback': function() {document.location = 'http://outbound.com'}});">Click Here</a>
This is because the Google Analytics tracking code is asynchronous. The user leaves the page before Google Analytics Javascript code can ping the Analytics server.
To fix this, you need to either open the outbound link in a new window, or set a hit callback, which will ensure the Analytics "hit" happens before the navigation.
<a onclick="ga('send', 'event', 'button', 'click', 'label', { 'hitCallback': function() { document.location = 'http://outbound.com'; }}); return false;" href="http://outbound.com">Click Here</a>
The example code would allow you to navigate the site with and without javascript, and search engines will see the link.