@rovestudio/web
v0.1.1
Published
Rove analytics for Next.js and other web apps. https://rovestats.com · Docs: https://rovestats.com/docs
Maintainers
Readme
@rovestudio/web
Rove analytics for Next.js and other JavaScript web apps.
- Website: https://rovestats.com
- Docs: https://rovestats.com/docs
The package only talks to your Rove host (POST /api/v1/events). It never sees your database.
Install
npm install @rovestudio/webNext.js
Create a client wrapper — the root layout can stay a Server Component.
// app/rove-provider.tsx
"use client";
import { RoveProvider } from "@rovestudio/web";
export function Rove({ children }: { children: React.ReactNode }) {
return (
<RoveProvider
writeKey={process.env.NEXT_PUBLIC_ROVE_KEY!}
host={process.env.NEXT_PUBLIC_ROVE_HOST!}
>
{children}
</RoveProvider>
);
}// app/layout.tsx
import { Rove } from "./rove-provider";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
<Rove>{children}</Rove>
</body>
</html>
);
}NEXT_PUBLIC_ROVE_KEY=rov_live_…
NEXT_PUBLIC_ROVE_HOST=https://rovestats.comRoveProvider records session_start and page_view on its own, including App Router client navigations. Tab hide/show becomes page_hide / page_show.
Any JS app
import { initRove, rove } from "@rovestudio/web";
initRove({
writeKey: process.env.ROVE_WRITE_KEY!,
host: "https://rovestats.com",
});
rove.track("purchase", { value: 9.99, currency: "USD" });
rove.identify("user_123", { plan: "pro" });
rove.page("/pricing");Options
| Prop | Default | Purpose |
| --- | --- | --- |
| writeKey | required | rov_live_… from the Rove dashboard |
| host | required | Origin of your Rove app, no trailing path |
| flushAt | 10 | Send once this many events are queued |
| flushInterval | 2000 | Flush interval in ms |
| sessionTimeoutMs | 30 * 60 * 1000 | New session after this long in a hidden tab |
| storage | localStorage | Override persistence |
| autoTrack.sessions | true | session_start |
| autoTrack.pageViews | true | page_view on load and history changes |
| autoTrack.pages | true | page_hide / page_show |
