Sample code
// update the profile with additional data points
Txt.updateProfile([
  {key: 'firstName', value: 'John', type: 'string'},
  {key: 'role', value: 'CMO', type: 'text', custom: true}
])

The update profile function enriches an existing visitor profile with additional data points.

Txt.updateProfile(data)

The data argument is required and should be an array of objects. The data object within the array should be structured as follows:

KeyTypeDescription
keystring
required
The key to store as a trait.
valuestring
required
The value to store.
typestring
required
The type of the data that you are sending, options are text, number, bool, date.
customboolean
optional
Set this to true if it is not a default trait - see list below.

📘

Set profile

The Txt.setProfile(data) function works exactly the same as Txt.updateProfile(data) except it will not immediately force an update. Instead, it will only happen locally and waits until the next call. This enables you to do multiple set profile calls in a function. This is better for resources and network traffic. It works well with the custom startup script feature in Unless.