Stats

Volume 13, Issue 58; 29 Dec 2010

Do you come here often?

When I converted this site to use MarkLogic Server, I also started collecting usage statistics. There's nothing terribly remarkable about that; it's basically the same data that's in a web server log file:

<http xmlns="http://norman.walsh.name/ns/modules/audit">
  <code>200</code>
  <verb>GET</verb>
  <uri>/2010/10/12/rebirth</uri>
  <dir>2010</dir>
  <filename>rebirth</filename>
  <ext/>
  <datetime>2010-12-29T15:09:21.642914-05:00</datetime>
  <ip>127.0.0.1</ip>
  <agent>Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US)
AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.231
Safari/534.10</agent>
  <referrer>http://localhost:8401/</referrer>
</http>

I use it to drive the popular page which, frankly, isn't very interesting.

Then the other day I realized I could combine a little XQuery with the Google Chart Tools to get instant feedback for any page.

For each page, I show the number of hits on that page in the last seven days and the last twenty-four hours. For the home page (as in the graph above), I show the aggregate for all the pages.

The rise of feed readers has made these sorts of statistics much less meaningfull except in a purely relative sense, but it's still interesting. That 40,000 hit spike, for example, happened on the day after I published Introducing the W3C HTML/XML Task Force.

Unfortunately, this whole essay is a bit of a cheek because you can't see the graphs. They're only shown to me (well, to admins, but that's only me). If adding more memory to this box improves performance, and I expect it will, I may open the graphs up for everyone.

The point, if there is one, aside from the fact that I find the graphs kind of cool, is how easy the were to create with less than 100 lines of XQuery and some free charting magic.