Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (_.isEmpty(eventName)) {
console.error('Mixpanel eventName cannot be empty'); // eslint-disable-line
return;
}
// Instantiate if not instantiated yet
if (!initialized) {
mixpanel.init(MIXPANEL_TOKEN);
initialized = true;
}
// Only track in production build
if (process.env && process.env.NODE_ENV === 'production') {
mixpanel.track(eventName, { id: getTrackingId() });
}
}
}