import { useEffect } from "react";
import { useLocation } from "wouter";
import { trackPageView } from "@/lib/analytics";

/**
 * Hook that tracks page views on route changes for SPA navigation.
 * Should be called once in the App component.
 */
export function usePageTracking(): void {
  const [location] = useLocation();

  useEffect(() => {
    trackPageView(location);
  }, [location]);
}
