"use client";

import { useEffect } from "react";
import { getVisitorId } from "@/lib/visitor";

export function AnalyticsTracker() {
  useEffect(() => {
    const visitorId = getVisitorId();

    fetch("/api/track", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        visitorId,
        path: window.location.pathname,
      }),
    });
  }, []);

  return null;
}
