SoftwarePractice.org: Home | Courseware | Wiki | Archive

SlimStat on CMSMadeSimple

From SoftwarePractice.org

I wanted a simple stats package to put on websites that I do for other people. In particular, I have a number of small websites for musical ensembles and the like, and I think those people would be interested and even excited to see where their site is being viewed from. For this, AWStats is overkill.

I decided to give SlimStat a try. Unlike AWStats, it doesn't analyze the log files, it executes a bit of PHP code on each page load. So it won't, for example, show image files (unless they are being downloaded via a PHP wrapper), or total bandwidth utilization. It uses mySQL to store its data, which I think is a plus. I decided to give it a go on a couple of installations of CMSMadeSimple.

Install

Installation was easy. Just download it and follow their instructions. I used the same database as the CMS install. Normally I would use a prefix on the tables but since there are only three and they are called slimstat, slimstat_dt, and slimstat_iptocountry, I left them as-is. (Always better to do what the software wants by default, if possible...)

To get slimstat in use by CMSMadeSimple (this was written for CMSMS 0.12.1), I had to modify the code. It seems not to be possible to paste PHP code into the CMSMS templates or global HTML blocks. (This is a good thing.)

So, modify the index.php file. Locate the line:

require_once(dirname(__FILE__)."/include.php"); #Makes gCms object

After it, add:

# Include SlimStat data collection script
include_once($config['root_path'].'/slimstat/inc.stats.php');

That's it! Bang through a few pages on the site and then reload slimstat in the browser.

http://www.mysite.com/slimstat/

Restricting Access

I'd like to restrict access somewhat. Ideally, someone logged into CMSMadeSimple should be able to view the SlimStat pages, without entering any additional passwords.

I'll work on it...

Personal tools