I want custom tracking in analytics. I have a custom JavaScript site.
When you click on the button I fire this code:
_gaq.push(['_trackEvent',1, 'Stappen', 'Eerste stap - Type woning']);
But when I go to analytics, by the events, it's not showing. It's not showing in analytics. What have I done wrong, am I missing something?
The code in the header:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-34399608-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
Are you using ga.js version on the analytics script? This is a requirement to use event tracking.
I would also look at the even tracking code, the 1 would need to be '1', and look like the code below on your html button:
<button type="button" onClick="_gaq.push(['_trackEvent', '1', 'Stappen', 'Eerste stap - Type woning']);">Button</button>
Google event tracking help section is here: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.