UNPKG

@jillen/analytics

Version:

Lightweight human-visit and Web Vitals analytics for React apps. Framework-agnostic core with a Next.js adapter.

19 lines (17 loc) 777 B
interface VisitorTrackerProps { username?: string | null; /** * Current route pathname. Required — pass from your router: * * • Next.js: `usePathname()` from `next/navigation` * (or use the `@jillen/analytics/next` adapter, * which wires this for you). * • React Router: `useLocation().pathname` * • TanStack Router: `useRouterState({ select: s => s.location.pathname })` * • Astro / vanilla: `window.location.pathname` and re-render on * route change. */ pathname: string; } declare function VisitorTracker({ username, pathname: rawPathname, }: VisitorTrackerProps): null; export { VisitorTracker, type VisitorTrackerProps };