Skip to main content

Node — Group

Associate users with groups (e.g. company, organization) and set group properties. Use groupIdentify() to set or update group attributes and group() to associate a user with a group.

groupIdentify(options, sessionId?, windowId?)

Set or update group properties. Sends $groupidentify.
OptionTypeRequiredDescription
groupTypestringyese.g. 'company', 'organization'
groupKeystringyesGroup identifier
propertiesRecord<string, JsonType>noGroup properties to set
signal.groupIdentify(
  { groupType: 'company', groupKey: 'acme', properties: { plan: 'enterprise', seats: 50 } },
  sessionId,
  windowId
);

group(distinctId, groupType, groupKey, properties?, sessionId?, windowId?)

Associate a user with a group. Sends $group_assign event. If properties are provided, also calls groupIdentify() to set group properties.
ParameterTypeRequiredDescription
distinctIdstringyesUser identifier
groupTypestringyesType of group (e.g. 'company', 'organization')
groupKeystringyesUnique identifier for the group
propertiesRecord<string, JsonType>noGroup properties to set
sessionIdstringnoFrom x-signal-session-id header for client correlation
windowIdstringnoFrom x-signal-window-id header for client correlation
When to use: When a user joins or is associated with a group (e.g. company, team, organization).
const { sessionId, windowId, distinctId } = getSessionInfo(req);

signal.group(
  distinctId || userId,
  'company',
  'acme',
  { role: 'admin' },
  sessionId,
  windowId
);

See also