Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function authSuccess(json, signUp) {
mixpanel.identify(json.data.id);
mixpanel.people.set({
$user_id: json.data.id,
$username: json.data.username,
$email: json.data.email, // only special properties need the $
$created: json.data.created_at,
$last_login: new Date(), // properties can be dates...
});
mixpanel.register({
username: json.data.username,
user_id: json.data.id,
});
return {
type: AUTH_SUCCESS,
user: json.data,
client: json.client,
accessToken: json.accessToken,
uid: json.uid,
export const incrementMixpanel = (event, data) => {
if (process.env.DISABLE_MIXPANEL !== '1' && process.env.MIXPANEL_API_TOKEN) {
try {
mixpanel.people.increment(event, data);
} catch (err) {
console.error(err);
}
}
};
componentDidMount() {
mixpanel.track(MP_FORTNITE_CLIENT_LOAD, {});
mixpanel.people.set({
open_on_startup: this.props.settings.launchOnStartup,
minimize_on_startup: this.props.settings.minimizeOnStartup,
minimize_to_tray: this.props.settings.minimizeToTray,
upload_bandwidth: this.props.settings.uploadBandwidth,
obs_mode: this.props.settings.pendingExternalOBSCapture,
match_processed_sound: this.props.settings.matchProcessedSound,
notifications_badge: this.props.settings.notificationsBadge,
manual_upload_notifications: this.props.settings.manualUploadNotifications,
auto_upload: this.props.settings.manualCaptureUpload,
});
}
set: (props: any) => {
if (doTracking) { Mixpanel.people.set(props); }
},
},
goToHome: (uploadBandwidth) => {
mixpanel.track(MP_USER_SETTING_CHANGE, { setting: 'upload_bandwidth', before: 0, after: uploadBandwidth });
mixpanel.people.set({ upload_bandwidth: uploadBandwidth });
dispatch(setUploadBandwidth(uploadBandwidth));
dispatch(setOnboardingComplete(true));
dispatch(push('/home'));
},
});
componentWillMount() {
this.checkAuth(this.props);
if (this.props.isAuthenticated) {
ipcRenderer.send('set-spectator-mode', this.props.spectator);
ipcRenderer.send('sign-in', this.props.user.id);
mixpanel.identify(this.props.user.id);
mixpanel.people.set({
$username: this.props.user.username,
$email: this.props.user.email,
});
mixpanel.register({
username: this.props.user.username,
user_id: this.props.user.id,
});
if (this.props.user.hasTeamAccess) {
this.props.loadTeam();
}
this.props.loadMatchNotifications();
this.fetchInterval = this.props.setInterval(() => {
this.props.loadMatchNotifications();
}, 15000);
this.props.clearCaptureError();
}
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)
})
}
function identifyInSentryAndMixpanel(host: string, userData: any): void {
if (process.env.DISABLE_MIXPANEL !== '1') {
mixpanel.identify((`${host} - ${userData.emailAddress}`));
mixpanel.people.set({
host,
version,
locale: userData.locale,
$timezone: userData.timeZone,
$name: userData.displayName,
$email: userData.emailAddress,
$distinct_id: `${host} - ${userData.emailAddress}`,
});
Raven.setUserContext({
host,
locale: userData.locale,
timeZone: userData.timeZone,
name: userData.displayName,
email: userData.emailAddress,
});
}
onChange={() => {
ipcRenderer.send('set-startup-settings', !launchOnStartup, minimizeOnStartup);
this.props.setLaunchOnStartup(!launchOnStartup);
mixpanel.track(MP_USER_SETTING_CHANGE, { setting: 'open_on_startup', before: launchOnStartup, after: !launchOnStartup });
mixpanel.people.set({ open_on_startup: !launchOnStartup });
}}
/>
onChange={() => {
ipcRenderer.send('set-notifications-badge', !notificationsBadge);
this.props.setNotificationsBadge(!notificationsBadge);
mixpanel.track(MP_USER_SETTING_CHANGE, { setting: 'notifications_badge', before: notificationsBadge, after: !notificationsBadge });
mixpanel.people.set({ notifications_badge: !notificationsBadge });
}}
/>