Auto-capture
When the provider initialises, Nohmo registers global listeners and tracks the following events with no extra code required.
| Event | Trigger | Data fields |
|---|---|---|
| PAGE_VIEW | Every route change | page, referrer, sessionId |
| TIME_SPENT | When navigating away from a page | seconds (time on previous page) |
| SCROLL_DEPTH | At 25%, 50%, 75%, 100% scroll milestones | depth (number) |
| CLICK | Any click on an interactive element | tag, text, href, x, y |
| RAGE_CLICK | Three or more clicks in quick succession | tag, text, x, y |
Note: All auto-captured events include deviceId, sessionId, and ts (ISO timestamp). You can disable any category via the options prop.
Manual page view hook
For routers Nohmo doesn't recognise automatically, use the hook:
tsx
import { usePageView } from 'nohmo'export default function MyPage() {usePageView('/my-page') // sends PAGE_VIEW once on mountreturn <div>…</div>}