Add more posthog analytics (privacy aware) (#6122)

This commit is contained in:
Zane
2025-12-16 08:59:14 -08:00
committed by GitHub
parent 036f4f74d9
commit 8a91f15731
34 changed files with 1339 additions and 48 deletions
+14
View File
@@ -4,9 +4,13 @@ import { ConfigProvider } from './components/ConfigContext';
import { ErrorBoundary } from './components/ErrorBoundary';
import SuspenseLoader from './suspense-loader';
import { client } from './api/client.gen';
import { setTelemetryEnabled } from './utils/analytics';
import { readConfig } from './api';
const App = lazy(() => import('./App'));
const TELEMETRY_CONFIG_KEY = 'GOOSE_TELEMETRY_ENABLED';
(async () => {
// Check if we're in the launcher view (doesn't need goosed connection)
const isLauncher = window.location.hash === '#/launcher';
@@ -26,6 +30,16 @@ const App = lazy(() => import('./App'));
'X-Secret-Key': await window.electron.getSecretKey(),
},
});
try {
const telemetryResponse = await readConfig({
body: { key: TELEMETRY_CONFIG_KEY, is_secret: false },
});
const isTelemetryEnabled = telemetryResponse.data !== false;
setTelemetryEnabled(isTelemetryEnabled);
} catch (error) {
console.warn('[Analytics] Failed to initialize analytics:', error);
}
}
ReactDOM.createRoot(document.getElementById('root')!).render(