close

做網站基本上少不了流量分析這一塊。感謝 Google 大神提供了 Google Analytics 這套工具,功能強大又免費,可以說是我們做網站的人的最佳拍檔。

 

 

基本上,要申請一個 Google Analytics 的步驟,我想網路上應該有不少相關參考文件,這裡就不再多說。

只不說,最近有一些比較特殊的經驗可以跟大家分享,讓大家參考,不用走不必要的冤枉路。

在申請完 Google Analytics 帳號後,要註冊一個網站,之後會拿到一個 Tracking ID (追蹤編號) 的東西,例如 UA-xxxxxxxx-x 。
2015-09-10_164302-1  

 

然後在 Admin 的畫面,Google Analytics 會提供一個類似以下的程式碼,讓你加到每一頁網頁的 html head 區段,做為 head 區段的最後一個 tag。

 

 

 

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxxx-x']);
_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);
})();
</script>
</pre>

裝好後再回到goolge analytics 就可以看到狀況了

2015-09-10_184409

  

 

 

 

arrow
arrow
    文章標籤
    Google Analytics Tracking Code
    全站熱搜

    Kenneth 發表在 痞客邦 留言(0) 人氣()