在javaeye blog中,开启专业流量统计工具Google Analytics

    首先,到博客设置中找到如下信息,并设置好相关内容:


    然后,到Google Analytics中创建网站配置文件,获得统计代码中关于AccountId,比如统计代码如下,标记的则是需要的id:

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'accountId']);//其中accountId即所需id
  _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);
  })();

    将AccountId填入上图的方框中,设置成功,等待一段时间,下图红色标记表示,ga正在接收数据,如果是感叹号,等待一段时间即可。


猜你喜欢

转载自kingour.iteye.com/blog/907742