Collect download statistics

This is some exploratory work I did one day that I've just dug up from a git stash. This might cover some of the needs of #26.