Wettone.com

SlimStat — A simple web stats analyser based on ShortStat

I've been using Shaun Inman's great ShortStat for a while. However, I wanted to be able to drill down into the stats and look at things in more detail.

When I started editing the code, I kept thinking of more and more things I'd like to change. SlimStat is the result.

It's evolving quite quickly, so stay tuned for more updates. So far it's at version 0.9.4.

SlimStat is free, and will remain so, but if you would like to make a donation, please use the link below. Thank you!

Contents

Download

Version 0.9.4 (including the IP-to-Country Database from 22 Mar 2006):

Alternatively, if you do not wish to use the IP-to-Country database, or if you would prefer to use a newer version of it, download the following file instead:

SlimStat is released under the GPL.

How SlimStat differs to ShortStat

There are too many changes to mention them all, but the major ones are:

  • Drill-down and filter data in any way you choose
  • Shows visits and unique IPs, not just hits
  • Option to hide visits from search engine crawlers
  • Allows you to ignore specified IP address ranges
  • Attempts to filter out spam
  • Contains several security fixes

Version history

Version 0.9.4:

  • Fixed a timezone offset bug in the Paths plugin
  • Fixed a bug that marked hits as spam if your domain name was too long
  • Fixed a bug causing some columns to be shown in the wrong order

Version 0.9.3:

  • Russian language support
  • Fixed detection of remote IP when server is behind a proxy
  • Fixed a bug with timezone offsets
  • Added rel="nofollow" to all external links

Version 0.9.2:

  • Refactored UTF-8 encoding for better IIS compatibility

Version 0.9.1:

  • Translated into French
  • Fixed some errors in the German translation
  • Improved UTF-8 encoding
  • Better compatibility with the IIS web server
  • Removed all short PHP tags

Version 0.9:

  • Ability to remove older data to reduce database size
  • Ability to specify the first day of the week
  • New wider layout for some modules to show more text
  • Translated into Dutch, German and Chinese (Traditional)

Version 0.8:

  • Huge internal rewrite for better extensibility
  • New 'Referrers' module which appears when filtering by domain
  • Links to whois services when filtering by visitor or domain
  • i18n

Version 0.7:

  • Slightly nicer colour scheme :-)
  • Re-implementation of the PathStats plugin for ShortStat
  • Option not to log hits from search engine crawlers, to reduce database size
  • The beginnings of a framework for plugins

Version 0.6:

  • Less memory-intensive import of the country data during setup
  • Option not to log user agent strings to reduce database size
  • Expanded Summary view with direct links to filter details
  • Positive/negative changes shown in green/red in date tables
  • Pageviews-per-visit module

Version 0.5:

  • RSS feeds for unique referrers, unique resources and daily hits
  • 'Next Resource' module shown when filtering by Resource
  • Summary section now shows new unique resources

Version 0.4:

  • Timezone support
  • Port of the ShortStat Widget gateway script
  • Summary section now shows new unique referrers
  • New panels showing hit totals by weekday or hour
  • Allow enabling/disabling of every module
  • Updated CSS with better IE support

Version 0.3:

  • Bookmarkable URLs for 'today', 'this week' and 'this month'
  • New Visitors panel showing most frequent visitor IP addresses
  • New Visits panel showing individual visits
  • Option to look up hostnames for IP addresses
  • Expanded Summary section

Screenshots

These screenshots show how you can filter the data to see precisely what you want. You can filter by anything and everything, and combine criteria in any way you choose. Click the images to enlarge.

All dataAll data

SummarySummary

TodayToday

Filter by countryFilter by remote IP

Filter by resourceFilter by resource

Filter by multiple criteriaFilter by multiple criteria

PathsPaths

Installation

1. Upload the entire slimstat directory to your server. The remainder of these instructions assume that you have uploaded this to the root level, i.e. that it is at http://www.example.com/slimstat/. Substitute your actual URL in all following examples.

2. Load http://www.example.com/slimstat/ in the web browser of your choice. Follow the instructions to complete installation.

3. Include the inc.stats.php file in your PHP wherever you would like stats to be counted. Use code similar to:

@include_once( $_SERVER["DOCUMENT_ROOT"]."/slimstat/inc.stats.php" );

4. That's it. Load http://www.example.com/slimstat/ in your web browser.

Migrating from ShortStat

You can keep your existing ShortStat data, although I recommend that you use the updated IP-to-Country database included in the download (or a later version).

To use your existing ShortStat data table, enter its name in _config.php, and execute the following SQL command to add the necessary fields to your table.

ALTER TABLE si_shortstat ADD searchterms VARCHAR(255) NOT NULL AFTER referer;
ALTER TABLE si_shortstat ADD visit INT UNSIGNED NOT NULL AFTER version;
ALTER TABLE si_shortstat ADD remote_addr VARCHAR(255) NOT NULL AFTER remote_ip;

SlimStat uses different labels to denote unidentifiable information. If you want to use the existing labels, edit _config.php to set them back to the ShortStat defaults. Otherwise, execute these commands.

UPDATE si_shortstat SET country='Unknown' WHERE country='';
UPDATE si_shortstat SET browser='Unknown' WHERE browser='Indeterminable';
UPDATE si_shortstat SET version='Unknown' WHERE version='Indeterminable';
UPDATE si_shortstat SET platform='Unknown' WHERE platform='Indeterminable';

Optionally, you can also add indexes to the table to improve SlimStat's speed.

ALTER TABLE si_shortstat ADD INDEX referer (referer);
ALTER TABLE si_shortstat ADD INDEX user_agent (user_agent);
ALTER TABLE si_shortstat ADD INDEX version (version);
ALTER TABLE si_shortstat ADD INDEX remote_ip_remote_addr (remote_ip,remote_addr);
ALTER TABLE si_shortstat ADD INDEX resource_total_uniques (resource,id,remote_ip);
ALTER TABLE si_shortstat ADD INDEX searchterms_total_uniques (searchterms,id,remote_ip);
ALTER TABLE si_shortstat ADD INDEX domain_total_uniques (domain,id,remote_ip);
ALTER TABLE si_shortstat ADD INDEX platform_total_uniques (platform,id,remote_ip);
ALTER TABLE si_shortstat ADD INDEX browser_version_total_uniques (browser,version,id,remote_ip);
ALTER TABLE si_shortstat ADD INDEX country_total_uniques (country,id,remote_ip);
ALTER TABLE si_shortstat ADD INDEX language_total_uniques (language,id,remote_ip);
ALTER TABLE si_shortstat ADD INDEX dt_total_uniques (dt,id,remote_ip);
ALTER TABLE si_shortstat ADD INDEX visit_total_uniques (visit,id,remote_ip);

SlimStat is not currently able to show search terms or visits from your existing data. I am writing converter scripts, which will be made available soon.

Upgrading from older versions of SlimStat

SlimStat 0.5 introduced a new field in the table, which you must add before running it.

ALTER TABLE slimstat ADD remote_addr VARCHAR(255) NOT NULL AFTER remote_ip;

If you don't want to use the updated IP-to-Country database, you can simply remove setup.php (or not upload it in the first place) and edit _config.php to match your settings. You will need to use the new version of _config.php because there may be new settings contained in it.

Older versions of SlimStat also included _languages.php, which is now obsolete and may be safely removed.

Feedback

I hope you find SlimStat useful. If you would like to send me some feedback, please join the SlimStat Google Group, or comment in the weblog post about this release.