Updating a profile

Audiences are joined by matching user profile fields using the audience builder in the Unless dashboard. To be able to set up these audiences, you first need to send us some profile fields using the updateProfile function:

// update the profile with additional data points
Txt.updateProfile([
  {key: 'firstName', value: 'John', type: 'text'},
  {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:

Key Type Description

key

string required

The key to store as a trait.

value

string required

The value to store.

type

string required

The type of the data that you are sending, options are text, number, bool, date.

custom

boolean 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.