This is what i send to Google Analytics:
// Default values?
var label = undefined;
var action = undefined;
// Assign some values
label = 'something';
action = 666;
// Send GA event
window._gaq.push(['_trackEvent','My Category', 'My Event Name', label, action]);
My question is: Am I right assigning default values as undefined as sometimes my label and action variables will not contain anything? Will event still be sent properly across all browsers?
Thanks for any help
Just don’t set them and send a 2 items array.
There are exemples in the official documentation : https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApi_gaq#_gaq.push