首先,到博客設置中找到如下信息,並設置好相關內容:
然後,到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正在接收數據,如果是感嘆號,等待一段時間即可。