made analytics library safer and implemented advanced events for Google Analytics