Google Analytics(分析)GIF请求未发送 [英] Google Analytics GIF request not sent

查看:102
本文介绍了Google Analytics(分析)GIF请求未发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在设置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



请参阅关于Intranet和开发服务器的Google Analytics(分析)以获取更多信息...



lockquote

如果您在网站的URL为
http:// intranet 或类似于 http:// mydevserver:12345 不会有
的工作。



具体来说,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...

If you’re using Google Analytics on a site with a URL like http://intranet/ or something like http://mydevserver:12345 it won’t work.

Specifically, the Google Analytics JS code will not send the tracking hit (__utm.gif) to the GA servers.

I don’t really know the specifics, but I’m guessing that the domain hashing code looks for at least one period in the hostname and won’t work if it doesn’t find one.

这篇关于Google Analytics(分析)GIF请求未发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆