「MediaWiki/Google Analyticsを導入」の版間の差分
提供: dsk's note
細 |
細 |
||
| 24行目: | 24行目: | ||
<div id="globalWrapper"> | <div id="globalWrapper"> | ||
</pre> | </pre> | ||
| + | |||
| + | [[Category: MediaWiki]] | ||
2014年1月9日 (木) 16:55時点における版
Google Analyticsを導入した。
当サイトの場合だと、MonoBookをデフォルトのデザインとして設定しているので、skins/MonoBook.phpの以下の箇所を編集しました。
本当はHTMLのheder部分を出力しているものが別に存在していると思われ、そこを編集したかったんだが、とりあえず動けばと暫定的に...
$this->html( 'headelement' ); ?><div id="globalWrapper">
$this->html( 'headelement' );
?>
<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-XXXXXXXX-X', 'sakura.ne.jp');
ga('send', 'pageview');
</script>
<div id="globalWrapper">