Quick start
Pick your framework and follow the steps. Most setups take under 5 minutes.
1
Install
bash
npm install nohmo
2
Wrap your root layout
Open app/layout.tsx and wrap your children with NohmoNextProvider. That's all — page views, clicks, scroll depth, and time spent are tracked automatically from this point.
tsx
// app/layout.tsximport { NohmoNextProvider } from 'nohmo'export default function RootLayout({ children }: { children: React.ReactNode }) {return (<html><body><NohmoNextProviderprojectId={process.env.NEXT_PUBLIC_NOHMO_PROJECT_ID!}apiKey={process.env.NEXT_PUBLIC_NOHMO_API_KEY!}>{children}</NohmoNextProvider></body></html>)}
3
Add your keys to .env.local
Get your project ID and API key from Dashboard → Settings → API Keys.
env
NEXT_PUBLIC_NOHMO_PROJECT_ID=proj_xxxxNEXT_PUBLIC_NOHMO_API_KEY=pk_xxxx
Note: Restart your dev server after adding env vars — Next.js won't pick them up otherwise.
4
Track a custom event (optional)
Use the useNohmo() hook anywhere inside the provider tree.
tsx
import { useNohmo } from 'nohmo'export default function BuyButton() {const { send } = useNohmo()return (<button onClick={() => send('purchase_started', { plan: 'pro' })}>Buy now</button>)}
5
Identify users at login (optional)
Call linkUser() after a successful login. All anonymous events from that device are retroactively attached to the user — nothing is lost.
tsx
const { linkUser } = useNohmo()const handleLogin = async () => {const user = await loginAPI()await linkUser(user.id, user.email)}
You're all set
Open your Nohmo dashboard. You should see devices and events appearing within seconds of your first page load.