
- Initialize analytics service on app startup in main.tsx - Integrate analytics consent management in App.tsx - Track app lifecycle events (start, screen changes) - Update Tauri configuration for production build - Set up proper analytics shutdown on app close - Ensure analytics is initialized before other services This completes the analytics integration setup with proper initialization and lifecycle management.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import React from "react";
|
|
import ReactDOM from "react-dom/client";
|
|
import App from "./App";
|
|
import { ErrorBoundary } from "./components/ErrorBoundary";
|
|
import { AnalyticsErrorBoundary } from "./components/AnalyticsErrorBoundary";
|
|
import { analytics, resourceMonitor } from "./lib/analytics";
|
|
import { PostHogProvider } from "posthog-js/react";
|
|
import "./assets/shimmer.css";
|
|
import "./styles.css";
|
|
|
|
// Initialize analytics before rendering
|
|
analytics.initialize();
|
|
|
|
// Start resource monitoring (check every 2 minutes)
|
|
resourceMonitor.startMonitoring(120000);
|
|
|
|
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
|
<React.StrictMode>
|
|
<PostHogProvider
|
|
apiKey={import.meta.env.VITE_PUBLIC_POSTHOG_KEY}
|
|
options={{
|
|
api_host: import.meta.env.VITE_PUBLIC_POSTHOG_HOST,
|
|
defaults: '2025-05-24',
|
|
capture_exceptions: true,
|
|
debug: import.meta.env.MODE === "development",
|
|
}}
|
|
>
|
|
<ErrorBoundary>
|
|
<AnalyticsErrorBoundary>
|
|
<App />
|
|
</AnalyticsErrorBoundary>
|
|
</ErrorBoundary>
|
|
</PostHogProvider>
|
|
</React.StrictMode>,
|
|
);
|