I’ve written elsewhere about my wish for a Dashboard widget that would track my site stats, and I’m happy to report that someone has finally come up with one. The ShortStat Widget from Keegan Jones—drawing on stats from Shaun Inman’s ShortStat—lets you check your hits, uniques, and recent referrers at a glance. But setting it up takes a little work. Here’s how…
First, create a database to hold your stat data (your host should provide instructions on how to create a database). You’ll need information about your database to configure ShortStat.
Then, go to the ShortStat Widget site. You’ll find links to everything you need from this page. Download ShortStat, the Gateway file, and the ShortStat Widget.
Follow the instructions in the Read Me included with the ShortStat package to install ShortStat on your server. Then upload the Gateway file to your ShortStat directory.
You’ll find some tips on using ShortStat with Moveable Type, Textpattern, and Wordpress in the “Playing Nice with ShortStat” entry on Shaun Inman’s site. Since I use Textpattern (1.0rc3), here’s what I did to set up ShortStat with Textpattern (thanks to John Hicks):
Add this line to the Index.php file in your home directory:
include($_SERVER["DOCUMENT_ROOT"]."/shortstat/inc.stats.php")
My Index.php file looks like this :
To block your own IP address, you’ll need to make a few changes to your configuration.php and inc.stats.php files (thanks to John Nunemaker).
Add this line to your configuration.php file (replacing x.x.x.x with your IP address, which you can find at WhatIsMyIP.com):
$exclude = array('x.x.x.x');
This section of the configuration.php file should look like this:
$shortstat = true; // False is off
$exclude = array('x.x.x.x');
?>
Put an if statement around the mysql_query function in your inc.stats.php file. So, this line:
@mysql_query($query);
}
Should look like this:
if ( !in_array($ip, $exclude) ){
@mysql_query($query);
}
}
Now when you check your stats, you shouldn’t see any of your own activity on your site.
ShortStats is great for getting a quick sense of your site traffic, but for more detailed stats, here are two free services to try:
StatCounter lets you track your site without having to display a link to StatCounter, but your log file is limited to the last 100 visitors.
AddFreeStats doesn’t limit your log file, but you have to display a link (see the bottom of the column on the right).
Note that both services work by tracking code embedded in your pages. If you have more than one page template, you’ll need to embed the code into every page (or page template) in your site.
If anyone has any other recommendations, please post a comment.
Bottom Line: ShotStat Widget is a great way to get a quick take on your Web stats.
From: Keegan Jones
Price: Free
Platform: Macintosh







