LocallyticsGrabber
Track pageviews from the browser.
Track pageviews automatically. For custom event tracking, see locallyticsCapture.
Usage
React / Next.js:
"use client";
import { LocallyticsGrabber } from "locallytics/client";
import { useEffect } from "react";
export default function RootLayout({ children }) {
useEffect(() => LocallyticsGrabber(), []);
return <html><body>{children}</body></html>;
}Vanilla JS:
<script type="module">
import { LocallyticsGrabber } from "locallytics/client";
LocallyticsGrabber();
</script>Options
LocallyticsGrabber({ endpoint: "/api/analytics" });| Option | Type | Default |
|---|---|---|
endpoint | string | "/api/analytics" |
What It Tracks
pageUrl— Current page pathreferrer— Previous page ornullsessionId— Anonymous UUID (localStorage)timestamp— ISO 8601 time
Privacy
- No cookies — Uses localStorage only
- Respects DNT — No tracking if Do Not Track is enabled
- No PII — No IP addresses or user agents collected