Node Integration
Use @signal-js/node with Node.js or Express to track events on the server and correlate them with client-side sessions. Create one client withcreateSignalNode() and reuse it across requests. Pass sessionId and windowId from request headers to link server events to the same session replay.
Quick start
- Install —
npm install @signal-js/node - Initialize — Create a client with
createSignalNode({ endpoint, apiKey, projectId })and a helper to readx-signal-session-id,x-signal-window-id,x-signal-distinct-idfrom requests. See Initialization. - Track events — Call
signal.capture()withsessionIdandwindowIdfrom the request. See Capture.
Sub-pages
| Page | Description |
|---|---|
| Initialization | Install, Node.js setup, Express setup, getSessionInfo |
| Capture | Track events with signal.capture() |
| Identify | Identify users with signal.identify() |
| Set person properties | setPersonProperties, setPersonPropertiesOnce |
| Group | groupIdentify, group — associate users with groups |
| Alias | Link alias to user with signal.alias() |
| Flush and shutdown | flush(), shutdown() |
| Configuration | createSignalNode options |
How it works
- Client SDK generates
sessionIdandwindowIdwhen initialized. - Tracing headers (when
addTracingHeadersis enabled on the client) add these to fetch/XHR:X-Signal-Session-Id,X-Signal-Window-Id,X-Signal-Distinct-Id. - Server reads these headers and passes
sessionIdandwindowIdintosignal.capture()(and other methods). - Result — Client and server events share the same identifiers and appear together in session replay.
Best practices
- Extract headers — Read the tracing headers from every request when you want correlation.
- Fallback to user ID — Use
distinctIdfrom headers when present, otherwise your own user ID. - Track key events — Call
signal.capture()for important business events. - One client per process — Create a single
createSignalNode()instance and reuse it. - Test correlation — Confirm client and server events appear in the same session in the dashboard.
