"use client"; import { useEffect } from "react"; /** Records one page view per visitor per day (server-side de-duplicated, bots excluded). Sends nothing else. */ export function ViewBeacon({ slug }: { slug: string }) { useEffect(() => { try { navigator.sendBeacon?.("/api/events", new Blob([JSON.stringify({ kind: "view", slug })], { type: "application/json" })) ?? fetch("/api/events", { method: "POST", body: JSON.stringify({ kind: "view", slug }), headers: { "Content-Type": "application/json" }, keepalive: true }); } catch {} }, [slug]); return null; }