Next.js — Set person properties
Update user properties without changing the distinct ID. UsesetPersonProperties to overwrite properties or setPersonPropertiesOnce to set them only if not already set. Available on both client and server.
Client: useSignal
GetsetPersonProperties and setPersonPropertiesOnce from useSignal():
Client: setPersonProperties(properties)
Sets or updates user properties (overwrites existing). Sends a$set event.
| Parameter | Type | Required | Description |
|---|---|---|---|
properties | Record<string, unknown> | yes | User properties to set or update |
Client: setPersonPropertiesOnce(properties)
Sets user properties only if they are not already set. Sends a$set_once event.
| Parameter | Type | Required | Description |
|---|---|---|---|
properties | Record<string, unknown> | yes | User properties to set (only if not already set) |
signupSource, firstPurchaseDate).
Server: setPersonProperties(distinctId, properties, sessionId?, windowId?)
Sets or updates user properties from the server. PasssessionId and windowId for client correlation.
| Parameter | Type | Required | Description |
|---|---|---|---|
distinctId | string | yes | User identifier |
properties | Record<string, unknown> | yes | User properties to set or update |
sessionId | string | no | From x-signal-session-id header for client correlation |
windowId | string | no | From x-signal-window-id header for client correlation |
Server: setPersonPropertiesOnce(distinctId, properties, sessionId?, windowId?)
Sets user properties only if not already set. PasssessionId and windowId for client correlation.
| Parameter | Type | Required | Description |
|---|---|---|---|
distinctId | string | yes | User identifier |
properties | Record<string, unknown> | yes | User properties to set (only if not already set) |
sessionId | string | no | From header for client correlation |
windowId | string | no | From header for client correlation |
Differences from identify()
- identify(distinctId, traits) — Changes the user’s distinct ID and sets properties. Use after login.
- setPersonProperties(properties) — Updates properties without changing the distinct ID. Use when properties change after identification.
- setPersonPropertiesOnce(properties) — Sets properties only if not already set. Use for immutable attributes.
See also
- Identify — identify() and reset()
- Capture — Track events
- Server tracking — Server-side patterns
