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

相关文章:

  • 2021-11-09
  • 2021-11-29
  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2021-09-01
猜你喜欢
  • 2021-11-21
  • 2022-12-23
  • 2022-01-30
  • 2021-07-07
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案