mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-09 13:15:51 +08:00
feat(core): make event track great again (#7695)
 
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user