move function into __main__ block
Merge branch 'master' of https://github.com/undeadlabs/analytics