refactoring mixpanel tracking