Google Analytics: Event Tracking Parameters

Harshal_m_joshi picture Harshal_m_joshi · Oct 8, 2011 · Viewed 8.4k times · Source

I am using ga for my website.

but when i call track event like this

_gaq.push(['_trackEvent', 'abc', 'def','pqr','xyz']);

it does not work but when i call function by removing last parameter i.e 'xyz' it works properly it looks like this

_gaq.push(['_trackEvent', 'abc', 'def','pqr']);

where _gaq is an array which contains my ga account no. and domain info.

my concern is I want to pass four parameter with '_trackEvent' parameter like this..

_gaq.push(['_trackEvent', category, action,label,value]);

but this is not working.

Plz help

Answer

Matt Austin picture Matt Austin · Oct 8, 2011

The Google Analytics API Event Tracking Guide states that the trackEvent method accepts 5 parameters:

  • category (required)
  • action (required)
  • label (optional)
  • value (optional)
  • non-interactive boolean (optional)

The second-to-last parameter (value) has to be an integer, and so does not work when a string is passed.