'use client'; import { useEffect } from 'react'; import { usePathname } from 'next/navigation'; export default function AnalyticsTracker() { const pathname = usePathname(); useEffect(() => { if (!pathname || pathname.startsWith('/admin') || pathname.startsWith('/api')) return; fetch('/api/analytics/track', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ path: pathname }), }).catch(() => { // Ignore background tracking errors }); }, [pathname]); return null; }