Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function setMixpanelTracking(config: AnalyticsConfig) {
if (MIXPANEL_ID) {
if (config.optedIn) {
log.debug('User has opted into analytics; tracking with Mixpanel')
mixpanel.identify(config.appId)
mixpanel.opt_in_tracking()
mixpanel.register({ appVersion: CURRENT_VERSION, appId: config.appId })
} else {
log.debug('User has opted out of analytics; stopping tracking')
mixpanel.opt_out_tracking()
mixpanel.reset()
}
}
}
reset: () => {
if (doTracking) { Mixpanel.reset(); }
},
track: (name: string, props = {}) => {
(dispatch) => {
mixpanel.reset();
dispatch(clearUserAuth());
dispatch(resetStateOnLogout());
dispatch(push('/welcome'));
}
);