0

GA trackEvent code isn't working.

onclick="_gaq.push(['_trackEvent', 'Navigation', 'Clicked', 'Button', 'Home']);"

The code above should be working but for some reason it's not. I'm looking at "Real Time" view in Google Analytics, on the "Events" tab and nothing shows up when I click.

Please help.

1 Answers1

1

Your fourth parameter (value) should be an integer, not a string:

_trackEvent(category, action, opt_label, opt_value, opt_noninteraction) category (required) The name you supply for the group of objects you want to track.

action (required) A string that is uniquely paired with each category, and commonly used to define the type of user interaction for the web object.

label (optional) An optional string to provide additional dimensions to the event data.

value (optional) An integer that you can use to provide numerical data about the user event.

non-interaction (optional) A boolean that when set to true, indicates that the event hit will not be used in bounce-rate calculation.

from here: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide

Eike Pierstorff
  • 31,996
  • 4
  • 43
  • 62
  • Back in those days someone had the same problem with the synchronous tracking code: http://stackoverflow.com/questions/1145639/trackevent-from-google-analytics-not-working?rq=1. I frankly don't know if this should count as a duplicate. – Eike Pierstorff Aug 01 '13 at 12:22