Support

Forums

Contact Me

Adding Google Analytics To MediaWiki

MediaWiki-logo 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>
You might also like:
Alternatives to Google Reader
61 days ago
Alternatives to Google Reader
I've been a huge fan of Google Reader for years. I usually start every morning with my coffee and
Google Data Centers virtual visit
201 days ago
Google Data Centers virtual visit
2 weeks ago, a post on Google's official blog announced a project that allows users to step inside t
Use always Google.com as default search engine in Chrome for
576 days ago
Use always Google.com as default search engine in Chrome for
Nothing is more disturbing than to be redirected to you local Google domain (.ch, .fr, .de or any
I’m Offering 50 Google+ invite !!!!!!
674 days ago
I’m Offering 50 Google+ invite !!!!!!
Google+ is a new social media platform currently in limited Field Trial only. You can only join Go
Internet is Best viewed in Chrome 12 Web browser
710 days ago
Internet is Best viewed in Chrome 12 Web browser
The latest version of a Chrome browser show its muscle in version 12 (just restart your chrome bro
Google IO Keynote are online
736 days ago
Google IO Keynote are online
Day 1 keynote where they announced Google Music, Movie Rentals, Android @ Home, Android Open Acce
blog comments powered by Disqus

Donations

Thank You for supporting my work