chore(core): handle the telemetry warnings in console (#6793)

This commit is contained in:
Brooooooklyn
2024-05-07 04:28:33 +00:00
parent 6cd0c7cd11
commit d76a635b00
4 changed files with 9 additions and 12 deletions

View File

@@ -15,6 +15,12 @@ export class TelemetryService extends Service {
}
onApplicationStart() {
if (process.env.MIXPANEL_TOKEN) {
mixpanel.init(process.env.MIXPANEL_TOKEN || '', {
track_pageview: true,
persistence: 'localStorage',
});
}
const account = this.auth.session.account$.value;
if (account) {
mixpanel.identify(account.id);

View File

@@ -6,14 +6,8 @@ import { useLayoutEffect } from 'react';
export function Telemetry() {
const settings = useAtomValue(appSettingAtom);
useLayoutEffect(() => {
if (process.env.MIXPANEL_TOKEN) {
mixpanel.init(process.env.MIXPANEL_TOKEN || '', {
track_pageview: true,
persistence: 'localStorage',
});
if (settings.enableTelemetry === false) {
mixpanel.opt_out_tracking();
}
if (settings.enableTelemetry === false) {
mixpanel.opt_out_tracking();
}
}, [settings.enableTelemetry]);
return null;