问题描述
我在设置Google Analytics时遇到了一些麻烦。我下载了Chrome的Google Analytics调试扩展程序,如果我查看控制台,则不会发送__utm.gif请求。我三重检查了我的代码,并且一切正常。 ga.js的调试版本正确下载。实际上,我遇到的问题与 ...
为此,我的追踪代码( UA - ######## - #
在我的原始代码中被正确替换)
var _gaq = _gaq || [];
_gaq.push(['_ setAccount','UA - ######## - #']);
_gaq.push(['_ trackPageview']);
(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);
})();
所有设置都正确,以下是我在控制台输出中获得的内容:
_gaq.push处理:[_setAccount,UA - ######## - #]
_gaq.push处理:[_trackPageview]
Track Pageview
然后没有别的。我尝试了一个同事的个人网站,我知道已安装Google Analytics,并且可以看到.gif文件的请求。
任何人都遇到过这个问题吗?
您是在localhost还是intranet上测试您的站点?如果是这样,您可能需要添加
_gaq.push(['_ setDomainName','none']);
之前 _trackPageview
请参阅以获取更多信息...
lockquote
如果您在网站的URL为
或类似于不会有
的工作。
具体来说,Google Analytics JS代码不会将跟踪
命中(__utm.gif)发送到GA服务器。
我不是很了解具体情况,但我是猜测域
hashing代码至少在主机名中查找一个句点,如果找不到
,它就不会工作。
I'm having some troubles setting up Google Analytics. I downloaded the Google Analytics Debugging extension for Chrome and if I take a look at the console, the __utm.gif request is never sent. I triple-checked my code, and everything is fine. The debugging version of ga.js is downloaded properly. In fact, I have the exact same problem as this guy that never got an answer...
For the sake of it, here is my tracking code (with UA-########-#
properly replaced in my original code, of course)
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-########-#']);
_gaq.push(['_trackPageview']);
(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);
})();
Everything is set up properly, and here is what I get in the console output :
_gaq.push processing : "[_setAccount, UA-########-#]"
_gaq.push processing : "[_trackPageview]"
Track Pageview
And then nothing else. I tried with a colleague's personal website that I know has Google Analytics installed and I can see the request for the .gif file.
Anyone ever had this problem ?
Are you testing your site on localhost or an intranet? If so, you may need to add
_gaq.push(['_setDomainName', 'none']);
before _trackPageview
See Google Analytics on Intranets and Development Servers for more info...
这篇关于Google Analytics(分析)GIF请求未发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!