Adds Google Analytics and fixes type bugs