Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'$referrer',
'$referring_domain',
],
}
const apiHost = process.env.REACT_APP_MIXPANEL_HOST
if (apiHost) {
options['api_host'] = apiHost
}
mixpanel.init(token, options)
// disable mixpanel to report data immediately
mixpanel.opt_out_tracking()
if (info?.disable_telemetry === false) {
mixpanel.register({
$current_url: getPathInLocationHash(),
})
mixpanel.opt_in_tracking()
}
}
handleModalYes() {
this.closeModal();
localStorage.setItem("tracking", true);
mixpanel.opt_in_tracking();
}
export function initRemoteTracker({gatherUsageStats, email}: {gatherUsageStats?: boolean; email?: string}): void {
if (gatherUsageStats != null) {
trackUsage = gatherUsageStats
}
if (trackUsage) {
mixpanel.identify(INSTALLATION_ID)
if (email) {
logMessage(`Email: ${email}`)
mixpanel.people.set({
'$email': email,
'$created': new Date().toISOString(),
})
}
mixpanel.opt_in_tracking()
} else {
mixpanel.opt_out_tracking()
}
logAlways('Track stats remotely: ', trackUsage)
preInitializationEventQueue.forEach(([eventName, opts]) => {
trackEventRemotely(eventName, opts)
})
}
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()
}
}
}