HI, I am using Google Analytics to track an event by click redirection. When anyone clicks on a link on my site, there is a Proxy where this code is there:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XXXX']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackEvent', 'XXXX', 'web_click', '', '1']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
and after that the visitor is redirected.
The Problem is, that the event is not visible in Analytics ... why?开发者_Python百科
Thanks Nik
That last parameter to _trackEvent must be an integer. Not a String. An Event with a String as the last parameter will be ignored without any warning.
Note that it must be an integer. A floating point number will also be ignore in the same way.
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XXXX']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackEvent', 'XXXX', 'web_click', '', 1]);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
精彩评论