feat: Add Google Analytics integration and fix anonymous tracking
- Add Google Analytics tracking (G-ZDZ26XYN2P) to frontend - Create comprehensive analytics utility with event tracking - Track URL submissions, analysis results, and user authentication - Add route tracking for SPA navigation - Fix CORS configuration to support both localhost and production - Fix home page tracking form to display results instead of auto-redirect - Add service management scripts for easier deployment - Update database migrations for enhanced analysis features Key Features: - Anonymous and authenticated user tracking - SSL/SEO/Security analysis event tracking - Error tracking for debugging - Page view tracking for SPA routes - Multi-origin CORS support for development and production
This commit is contained in:
20
apps/web/src/components/Analytics/RouteTracker.tsx
Normal file
20
apps/web/src/components/Analytics/RouteTracker.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Route Tracker Component
|
||||
*
|
||||
* Tracks page views for Google Analytics in SPA navigation
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { trackPageView } from '../../utils/analytics';
|
||||
|
||||
export function RouteTracker() {
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
// Track page view on route change
|
||||
trackPageView(location.pathname + location.search, document.title);
|
||||
}, [location]);
|
||||
|
||||
return null; // This component doesn't render anything
|
||||
}
|
||||
Reference in New Issue
Block a user