Refactor analytics partial