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