Updated code for Google Analytics