Custom events

Call send() anywhere inside the provider tree to track any business action.

tsx
import { useNohmo } from 'nohmo'
const { send } = useNohmo()
// basic
send('video_played', { videoId: 'abc123' })
// with page context
send('checkout_step', { step: 2, cartTotal: 149.99 })
// fire and forget — events are batched automatically
send('search', { query: 'running shoes', results: 42 })

Event naming

Use SCREAMING_SNAKE_CASE for event names to stay consistent with auto-captured events. The data object can be any JSON-serialisable value.

Note: Events are queued in memory and sent in a single batch every flushInterval ms via navigator.sendBeacon, with fetch as fallback. This means events survive page unload and never block the main thread.