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

@@ -43,5 +43,12 @@ export async function createApp() {
app.useWebSocketAdapter(adapter);
}
if (AFFiNE.isSelfhosted && AFFiNE.telemetry.enabled) {
const mixpanel = await import('mixpanel');
mixpanel.init(AFFiNE.telemetry.token).track('selfhost-server-started', {
version: AFFiNE.version,
});
}
return app;
}

View File

@@ -333,6 +333,11 @@ export interface AFFiNEConfig {
metrics: {
enabled: boolean;
};
telemetry: {
enabled: boolean;
token: string;
};
}
export * from './storage';

View File

@@ -192,6 +192,10 @@ export const getDefaultAFFiNEConfig: () => AFFiNEConfig = () => {
metrics: {
enabled: false,
},
telemetry: {
enabled: isSelfhosted && !process.env.DISABLE_SERVER_TELEMETRY,
token: '389c0615a69b57cca7d3fa0a4824c930',
},
plugins: {
enabled: new Set(),
use(plugin, config) {