Ga Event Tracking From Localhost
Solution 1:
Try put this line before the first pageview:
_gaq.push(['_setDomainName', 'none']);
Your tracker will be similar this:
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345-1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_trackPageview']);
</script>
This option works directly with the cookie configuration, so use only for locahost!
Solution 2:
The New "Universal Analytics" API
Google is transitioning everyone over to a new system and you probably already have the new code snippet in your pages. They have changed many of the APIs including the event tracking.
Make sure you use this call after the main snippet
ga('create', 'UA-XXXXXXXX-X', {
'cookieDomain': 'none'
});
ga('send', 'pageview');
Again this option works directly with the cookie configuration, so use only for localhost!
There is a thorough blog post on the subject http://blog.tylerbuchea.com/tracking-events-in-googles-new-universal-analytics/
And here is the official Google documents on the new API https://developers.google.com/analytics/devguides/collection/analyticsjs/events
Post a Comment for "Ga Event Tracking From Localhost"