Google Analytics is one of the best free web-statistics services available. It’s also quite easy to use with MediaWiki. To install Google Analytics in you MediaWiki you should put the tracking code, which is something that looks like:
in every page, preferably just above the </body> tag. The best way to do so will be to put the tracking code inside the base skin php file. That means that unless you changed the default skin for MediaWiki you need to edit
/wiki/skins/MonoBook.php. In this file you will find the </body> tag towards the bottom of the file. Insert the tracking code just above it, save the file, and you’re done, as all pages will now show the script. Google Analytics will start gathering statistics usually in about 24-28 hours.
If you also want to track external links to files and other websites take a look at
Tracking Mediawiki External Links Statistics Using Google Analytics.