feat: integrate analytics into main app

- Initialize analytics service on app startup
- Add PostHogProvider wrapper for React integration
- Include AnalyticsConsentBanner in App component
- Set up app lifecycle tracking with useAppLifecycle hook
- Configure PostHog with environment variables
This commit is contained in:
Vivek R
2025-07-30 19:44:29 +05:30
parent ac7ac0e39e
commit fcb83fc6d0
2 changed files with 26 additions and 3 deletions

View File

@@ -25,6 +25,8 @@ import { TabManager } from "@/components/TabManager";
import { TabContent } from "@/components/TabContent";
import { AgentsModal } from "@/components/AgentsModal";
import { useTabState } from "@/hooks/useTabState";
import { AnalyticsConsentBanner } from "@/components/AnalyticsConsent";
import { useAppLifecycle } from "@/hooks";
type View =
| "welcome"
@@ -60,6 +62,9 @@ function AppContent() {
const [projectForSettings, setProjectForSettings] = useState<Project | null>(null);
const [previousView] = useState<View>("welcome");
const [showAgentsModal, setShowAgentsModal] = useState(false);
// Initialize analytics lifecycle tracking
useAppLifecycle();
// Load projects on mount when in projects view
useEffect(() => {
@@ -464,6 +469,9 @@ function AppContent() {
onAgentsClick={() => setShowAgentsModal(true)}
/>
{/* Analytics Consent Banner */}
<AnalyticsConsentBanner />
{/* Main Content */}
<div className="flex-1 overflow-hidden">
{renderContent()}