Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

_trackEvent() from Google Analytics not working?

Tags:

I have Google Analytics setup on my site, and it is definitely recording page views. But I have added some code to call pageTracker._trackEvent(category, action, label, value), and it is not recording those hits or showing them in the reports.

BTW, yes, I have waited for over 24hrs to see if the hits are in the reports.

I have used the standard Google script include as well as the technique mentioned here. Neither one seems to help the _trackEvent() problem.

Can anyone give me some advice on how to track down what's going wrong? I'd be happy to post code examples if you let me know what parts are important.

Thanks.

like image 589
slolife Avatar asked Jul 17 '09 20:07

slolife


People also ask

How do I see events in Google Analytics using console?

Go to the webpage where you have set up the Google events. The console now needs to be opened. You can right click -> inspect element and then click the console tab.

What is event value in Google Analytics?

Event value is an optional metric in Google Analytics (GA) that can be used to evaluate user interactions with individual site objects or content items.


2 Answers

The problem was the values that I was putting in the final argument, the "value" parameter.

pageTracker._trackEvent(category, action, label, value)

I was passing non-integer strings to the "value" parameter:

pageTracker._trackEvent("UserAction", "ShowHelp", "Page", "http://mysite/UrlGoesHere");

but the docs say it needs to be an integer value.

pageTracker._trackEvent("UserAction", "ShowHelp", "http://mysite/UrlGoesHere",  1);

I posed the question on Google Help Forums here.

And here is a link to the Event Tracking docs

Thanks for the help Török

like image 69
slolife Avatar answered Sep 28 '22 07:09

slolife


Similarly, label can not be an integer or the _trackEvent function fails silently.

pageTracker._trackEvent('VLP', 'click-out', 12345);

Fixed as

pageTracker._trackEvent('VLP', 'click-out', '12345');
like image 30
KevBurnsJr Avatar answered Sep 28 '22 08:09

KevBurnsJr