forehalo
2024-08-06 08:39:28 +00:00
parent f93743dae6
commit cc09085dc2
17 changed files with 496 additions and 198 deletions
+4 -1
View File
@@ -2,13 +2,16 @@ import { appSettingAtom } from '@toeverything/infra';
import { useAtomValue } from 'jotai/react';
import { useLayoutEffect } from 'react';
import { mixpanel } from './mixpanel';
import { enableAutoTrack, mixpanel } from './mixpanel';
export function Telemetry() {
const settings = useAtomValue(appSettingAtom);
useLayoutEffect(() => {
if (settings.enableTelemetry === false) {
mixpanel.opt_out_tracking();
return;
} else {
return enableAutoTrack(document.body, mixpanel.track);
}
}, [settings.enableTelemetry]);
return null;