
Adding Google Analytics To MediaWiki

I search and search on how to add a Google analytics to MediaWiki, seems pretty damn simple as long as you know which templates you are using as default.
The current skins is configured in LocalSettings.php
## Default skin: you can change the default skin. Use the internal symbolic ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook': $wgDefaultSkin = 'monobook';
Head to {mediawiki_root}/skins and edit the right skins, for me it is MonoBook.php
Just add your analytics scripts before the </body>. Now MediaWiki will add the marker in every page
Before
<?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?> <?php $this->html('reporttime') ?> <?php if ( $this->data['debug'] ): ?> <!-- Debug output: <?php $this->text( 'debug' ); ?> --> <?php endif; ?> </body></html>
After
<?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?> <?php $this->html('reporttime') ?> <?php if ( $this->data['debug'] ): ?> <!-- Debug output: <?php $this->text( 'debug' ); ?> --> <?php endif; ?> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost
+ "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-88600-7"); pageTracker._trackPageview(); } catch(err) {}</script> </body></html>