http://www.useragents.org/develop-wbstat.asp è una soluzione eccellente, ma in ASP.
Puoi valutare un porting su Ruby.