feat(analytics): configure analytics initialization and app integration

- 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.
This commit is contained in:
Vivek R
2025-07-31 14:22:58 +05:30
parent db1efc2831
commit 9c253baec8
3 changed files with 27 additions and 4 deletions

View File

@@ -2,7 +2,8 @@ import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import { ErrorBoundary } from "./components/ErrorBoundary";
import { analytics } from "./lib/analytics";
import { AnalyticsErrorBoundary } from "./components/AnalyticsErrorBoundary";
import { analytics, resourceMonitor } from "./lib/analytics";
import { PostHogProvider } from "posthog-js/react";
import "./assets/shimmer.css";
import "./styles.css";
@@ -10,6 +11,9 @@ 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
@@ -22,7 +26,9 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
}}
>
<ErrorBoundary>
<App />
<AnalyticsErrorBoundary>
<App />
</AnalyticsErrorBoundary>
</ErrorBoundary>
</PostHogProvider>
</React.StrictMode>,