chore(core): add mixpanel track (#6202)

This commit is contained in:
Brooooooklyn
2024-03-22 09:24:40 +00:00
parent 10af0ab48d
commit 150c22936d
21 changed files with 229 additions and 67 deletions

View File

@@ -18,6 +18,7 @@ import { createI18n, setUpLanguage } from '@affine/i18n';
import { CacheProvider } from '@emotion/react';
import { getCurrentStore } from '@toeverything/infra/atom';
import { ServiceCollection } from '@toeverything/infra/di';
import mixpanel from 'mixpanel-browser';
import type { PropsWithChildren, ReactElement } from 'react';
import { lazy, Suspense } from 'react';
import { RouterProvider } from 'react-router-dom';
@@ -62,6 +63,13 @@ const serviceProvider = services.provider();
export function App() {
performanceRenderLogger.info('App');
if (process.env.MIXPANEL_TOKEN) {
mixpanel.init(process.env.MIXPANEL_TOKEN || '', {
track_pageview: true,
persistence: 'localStorage',
});
}
if (!languageLoadingPromise) {
languageLoadingPromise = loadLanguage().catch(console.error);
}