I'm having some noob troubles with Google Analytics and _trackEvent.
Using it seems straight forward in the documentation, but I can't get this simple example to work. The call to _trackEvent fails with 'TypeError: o is undefined'
The call to _trackPageview is succeeding and I can see it updated in the analytics dashboard.
I tried peeking at ga.js to understand what's up - just have a headache to show for it!
This is my first foray into GA - especially with custom events. The account is new. Everything seemed to be correctly setup - but I probably wouldn't know if it wasn't!
It seems so simple - but obviously I'm missing something. Any help with removing my blind-folds is much appreciated!
-vs
Example HTML - only need a tracking code.
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
var pageTracker;
try {
pageTracker = _gat._getTracker("UA-XXXXXX-1");
pageTracker._trackPageview();
} catch(err) {
console.log(err.toString());
}
$(document).ready(function() {
try {
pageTracker._trackEvent('my_category', 'my_action', 'my_optional_label', 42);
} catch(err) {
console.log('trackEvent ' + err.toString());
}
});