欢迎大家下载试用折桂单点登录系统, https://www.zheguisoft.com

发现 google 网站管理员工具中给出的 javascript 代码是错误的

google 提供访问统计,并给出使用 google 统计的 javascript 代码。这部分代码已经更改了几次了,最近的版本是异步提交,也就是不影响你的网站页面显示速度,先显示你的网页,再后台悄悄提交一个用于统计的 http request。

https://www.google.com/analytics/settings/check_status_profile_handler?id=21886899

页面中, google 给出如下代码:

  var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5907003-6']);
_gaq.push(['_setDomainName', '.zhegui.biz']);
_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(['_trackPageview']);
_gaq.push(['_setDomainName', '.zhegui.biz']);

 

也就是 trackPageview 一行需要往上升一行。这样才会访问:

http://www.google-analytics.com/__utm.gif

我已经在 google 论坛中报告此事,不知道他们需要多长时间反馈。

 

欢迎大家访问我们的网站:

http://zhegui.biz

posted @ 2010-12-10 18:17  杰克伦敦尘  Views(1104)  Comments(1Edit  收藏  举报
欢迎大家下载试用折桂单点登录系统, https://www.zheguisoft.com