This article outlines how I use a pre-commit hook and cog to keep my blog stats updated automatically.
Grab a piece of paper and try to fold your way out of this problem.