Skip to main content

Node — Set person properties

Set or update user properties from the server with setPersonProperties (overwrites) or setPersonPropertiesOnce (only if not already set). Pass sessionId and windowId when correlating with the client session.

setPersonProperties(distinctId, properties, sessionId?, windowId?)

Sets user properties (overwrites). Sends $set event.
ParameterTypeRequiredDescription
distinctIdstringyesUser identifier
propertiesUserTraitsyesUser properties to set or update
sessionIdstringnoFrom x-signal-session-id header for client correlation
windowIdstringnoFrom x-signal-window-id header for client correlation
When to use: Update user properties without sending an $identify event (e.g. when properties change after initial identification).
const { sessionId, windowId, distinctId } = getSessionInfo(req);

signal.setPersonProperties(
  distinctId || userId,
  { plan: 'pro', role: 'admin' },
  sessionId,
  windowId
);

setPersonPropertiesOnce(distinctId, properties, sessionId?, windowId?)

Sets user properties only if not already set. Sends $set_once event.
ParameterTypeRequiredDescription
distinctIdstringyesUser identifier
propertiesUserTraitsyesUser properties to set (only if not already set)
sessionIdstringnoFrom x-signal-session-id header for client correlation
windowIdstringnoFrom x-signal-window-id header for client correlation
When to use: One-time attributes that shouldn’t be overwritten (e.g. signupSource, firstPurchaseDate).
const { sessionId, windowId, distinctId } = getSessionInfo(req);

signal.setPersonPropertiesOnce(
  distinctId || userId,
  { signupSource: 'organic' },
  sessionId,
  windowId
);

See also