React — Capture
Track custom events from your React components using the Signal hooks. UseuseSignal() for full SDK access or useSignalCapture() for a memoized capture function.
useSignal
Get the full Signal SDK instance and callcapture (or any other method):
useSignal() returns: signal, isInitialized, isRecording, sessionId, distinctId, capture, identify, setPersonProperties, setPersonPropertiesOnce, group, register, registerOnce, unregister, getSuperProperties, alias, reset, optOut, optIn, hasOptedOut, startRecording, stopRecording, pauseRecording, resumeRecording, flush. See individual method pages for details.
useSignalCapture
Get only a memoized capture function (useful when you only need to track events):capture(eventName, properties?)
- eventName (
string) — Event name (e.g.'order_created','add_to_cart'). - properties (
Record<string, unknown>optional) — Arbitrary JSON-serializable properties.
signal.capture() (from useSignal()) and the function returned by useSignalCapture() have the same signature. Events are sent in batches; identity and session context are attached automatically.
Example
See also
- Identify — Set user identity
- Page views — Track page views and useTrackEvent
