Comments

Google Analytics 追蹤碼更新改版了


G

oogle官方部落格發佈了新的消息,Google Analytics的追蹤Javascript程式碼重新更新改版,據官方表示..新的程式碼有以下優點:更快速的載入時間、加強資料收集的準確性、排除語法未完全載入所發生的錯誤問題。

安裝方法很簡單,先刪除舊的程式碼,將新的程式碼放在</body>之前。

新版程式碼
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();

</script>


紅色字表示你的網站代碼,登入Google Analytics後台就可以看到。




參考網站:http://code.google.com/intl/zh-TW/apis/analytics/docs/tracking/asyncTracking.html
read more...
Back To Home Subscribe My Post Subscribe My Comment Large Font Size Default Font Size Small Font Size Sign in Blogger Sign in Draft Blogger Follower Me! Follower My Twitter! Follower My Plurk!