2013年10月24日 星期四

Google Analytics整合至你的網頁

GA提供了幾個解決方案給使用者在他的網頁中加入追蹤碼,
並且放置在管理員→資源→追蹤資訊→追蹤程式碼裡面,
只要把Google提供的程式碼貼到你的</head>上方就可以嚕,
下面是我的追蹤碼:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-00000000-0', 'harrywutechnology.blogspot.tw');
  ga('send', 'pageview');

</script>

這邊要注意一下,當初如果你輸入的網址是intranet.com,也就是你的網站非對外連線網站,
那你這邊的程式碼要稍微動工一下,將intranet.com更改為none,如下:

ga('create', 'UA-00000000-0', 'none');

這樣你的非對外連線網站才會被 GA追蹤到資訊喔!

沒有留言:

張貼留言