Note! The following shows one way of collecting visitor statistics, but applies for WordPress installations only. If you are looking to get site statistics for any other CMS or blogging platform please see their respective lists of available plugins or try AWStats (which is a very good server log analyser tool).
WP Slimstat for WordPress
There’s dozens of statistic plugins available for WordPress already, but I find WP Slimstat to be one of the best. However, since the release of WordPress 2.3 the plugin no longer recorded all hits as the WP table structure was altered. The author of WP-Slimstat still offers the plugin from his website but informs visitors that it’s no longer in development.
Earlier today I found the solution to the problem in one of the forum threads. Having waited for a decent solution for some time I decided to implement the necessary code changes but also keep it backwards compatible. The updated copy of the main file (wp-slimstat.php), including the new WP 2.5 colour scheme, can be downloaded below:
[download#1#size]
Before you continue I recommend backing up your database. This way you can always roll back in case something goes terribly wrong. I’ve just completed the update myself without any issues so I hope and think there shouldn’t be any surprises.
If this didn’t scare you away you can now proceed with the actual update. All you need to do is replace the old copy of wp-slimstat.php with the new one included in the zip, using your favourite FTP program (e.g. FileZilla).
Update the IP to Country Database
The plugin also shows you where your visitors are coming from by comparing the IP against the “IP to Country database” made available by webhosting.info. The original is now a bit old (March 2006) so I’ve made an SQL dump that contains the latest list (10th March 2008):
[download#2#size]
You can update your IP to Country database table as follows:
- Log on to phpMyAdmin (or any other tool you use to maintain your database) and empty the old table (normally wp_slim_countries)
- Unzip and upload the file you just downloaded (wp_slim_countries.sql) using the import feature
If you experience difficulties uploading the file (it is quite large -> 2.56MB) you can try bypassing this by opening the file in WordPad (not NotePad), copy all the text (CTRL+A and then CTRL+C) then paste (CTRL+V) and run it as an SQL query in phpMyAdmin.
Feel free to let me know if you experience any problems or have a comment on this unofficial WP Slimstat release.