Analytics that live with your app.
Stop paying someone else to manage your analytics.
npm i locallytics
Lightweight
No external dependencies. Keep your bundle small and your app fast.
Privacy-First
No cookies, no tracking. Uses localStorage and respects DNT headers.
Self-Hosted
Your data, your database, your infrastructure. Complete control.
Type Safe
Full TypeScript support throughout the SDK for a better developer experience.
Flexible
Custom adapter interface lets you bring your own database solution.
Fast
Event batching and sendBeacon() API for optimal performance.
Simple setup
1
Add to your layout
import { AnalyticsGrabber } from "locallytics";
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<AnalyticsGrabber />
</body>
</html>
);
}2
View your analytics
import { AnalyticsJSON } from "locallytics";
export default async function AnalyticsPage() {
const data = await AnalyticsJSON({});
return (
<pre>
{JSON.stringify(data, null, 2)}
</pre>
);
}Everything you need
Track pageviews, unique visitors, top pages, daily stats, referrers, and custom events.
PageviewsUnique VisitorsTop PagesDaily StatsReferrersCustom Events