code refactor on google analytics