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:
19
src/App.tsx
19
src/App.tsx
@@ -26,7 +26,7 @@ import { TabContent } from "@/components/TabContent";
|
||||
import { AgentsModal } from "@/components/AgentsModal";
|
||||
import { useTabState } from "@/hooks/useTabState";
|
||||
import { AnalyticsConsentBanner } from "@/components/AnalyticsConsent";
|
||||
import { useAppLifecycle } from "@/hooks";
|
||||
import { useAppLifecycle, useTrackEvent } from "@/hooks";
|
||||
|
||||
type View =
|
||||
| "welcome"
|
||||
@@ -65,6 +65,23 @@ function AppContent() {
|
||||
|
||||
// Initialize analytics lifecycle tracking
|
||||
useAppLifecycle();
|
||||
const trackEvent = useTrackEvent();
|
||||
|
||||
// Track user journey milestones
|
||||
const [hasTrackedFirstChat] = useState(false);
|
||||
// const [hasTrackedFirstAgent] = useState(false);
|
||||
|
||||
// Track when user reaches different journey stages
|
||||
useEffect(() => {
|
||||
if (view === "projects" && projects.length > 0 && !hasTrackedFirstChat) {
|
||||
// User has projects - they're past onboarding
|
||||
trackEvent.journeyMilestone({
|
||||
journey_stage: 'onboarding',
|
||||
milestone_reached: 'projects_created',
|
||||
time_to_milestone_ms: Date.now() - performance.timing.navigationStart
|
||||
});
|
||||
}
|
||||
}, [view, projects.length, hasTrackedFirstChat, trackEvent]);
|
||||
|
||||
// Load projects on mount when in projects view
|
||||
useEffect(() => {
|
||||
|
Reference in New Issue
Block a user