Add Google Analytics code and fix minor bugs from pull requests