最新のGoogle Analytics(非同期)で404をトラッキングする | 東京都世田谷区 ホームページ制作 [k]id

最新のGoogle Analytics(非同期)で404をトラッキングする

Category WEB Tips Update 2011.05.02

twitterfacebookgoogle+はてなブックマークPocketであとで読むfeedlyで購読

この前、Google Analyticsのコードを非同期トラッキングに変更しました。

以前は404 エラー ページをトラッキングするのコードを使用していたのですが、トラッキングコードが_gaq.pushになったので変更。。


<script type="text/javascript">var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview', '/404.html?page=' + document.location.pathname + document.location.search + '&from=' + document.referrer]);
(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>

レポートで /404.html を検索すれば404 ページにアクセスしたページ URL がわかりますね。

ページトップへ