Using Google Analytics with Mediawiki
From Foochal
[edit]
Getting a Google Analytics account
- Get a free Google account
- Sign up for Google Analytics account
- You will get a javascript code that you need to include in each page that you want to track. The code must appear before the </body> tag. The code looks as follows:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-xxxxxx-x"; urchinTracker(); </script>
[edit]
Configuring MediaWiki
- The installation of this code in MediaWiki is simple. Insert the code in your Monobook.php file. The location of Monobook.php file is as follows:
<you mediawiki installation dir>/skins/Monobook.php
- Open the file in a text editor (like vi) and scroll to the end of the file. Insert the code between the following lines:
<?php $this->html('reporttime') ?>
</body>
</html>
<?php
wfRestoreWarnings();
}
}
- Your final code would look like this:
</ul>
</div>
</div>
<?php $this->html('reporttime') ?>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script>
<script type="text/javascript"> _uacct = "UA-XXXXXX-X"; urchinTracker(); </script>
</body>
</html>
<?php
wfRestoreWarnings();
}
}
?>

