There are some solutions out there for logging analytics information to the database. I wanted something really simple and minimalistic. This set of scripts monkey patches each request to write some basic information out to the database after the request data is sent to the user. Because of this it should not impact the speed of your site. In a situation where you can’t or don’t want to use something like Google analytics this gets the job done. You can change it to capture any information that is useful to you.
You can find it on Github.