Google Universal Analytics Localhost Setup

时间秒杀一切 提交于 2019-12-12 08:31:45

问题


I'm trying to test GA on localhost after following the suggestions in Can you test google analytics on a localhost address?

1). but I don't see any data being send to my Google Analytics account when browsing on my localhost server and calling the JS script. I know it's executing the JS. What am I doing wrong? Here is my JS code:

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-55555555-1', {
  'cookieDomain': 'none'
});

ga('send', 'timing', 'jQuery', 'Load Some Test Library', 20, 'Google Test');

2). Also, I'm confused about GA requiring a default domain to be set under Admin --> Property --> Property Settings. If I declare 'cookieDomain':'none', does that mean the domain as part of my GA account is ignored?

Cheers,

partizan

来源:https://stackoverflow.com/questions/19943786/google-universal-analytics-localhost-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!