Refactor google analytics