Vidar Hokstad


Sliding Stats is a small little piece of code I'm working on to plug into any Rack enabled Ruby web app (and practically any Ruby web-framework can work with Rack these days) to give me glimpse of what's going on without having to tail referrer logs etc.
It doesn't do all that much, and I don't want it to: It keeps a "sliding window" of requests that doesn't match a list of criteria for things you want to ignore, and maintains a graph of referrers, pages, and referrers broken down by pages (the latter as a table). When the limit is hit, old requests are removed, so if you set the limit for the window low enough, you'll see a constantly changing view of where people are clicking through to your site from, and to what pages.

For an example of what it looks like, see my stats page

Since it ties in with Rack you can use this regardless of what web framework you use, as long as it has a Rack adapter. That means Rails, Merb, Sinatra, Camping and bunch of others.

The code is on GitHub. Installation instructions and a gem can be found at http://www.hokstad.com/slidingstats. Please note it has version number 0.2.3 for a reason, so don't try it out on any sites you worry about actually keeping running - I'm sure there are nasty bugs in there. Comments / suggestions welcome...

I don't plan on adding all that many enhancements to it - for "proper stats" I use Google Analytics - but I will tweak things like the filtering of requests, and I want to add an option to make the limit time based instead of just by number of queries. I'll probably clean up the CSS a bit too, and pretty up the SVG graphs.

To install it you'll need SVG::Graph installed - unfortunately I don't think there's any gems for that available.

UPDATE: Fixed some rather embarrassing bugs - if you downloaded 0.2.3 you may want to upgrade.


blog comments powered by Disqus