List attributes

You can now store list attributes in Userflow (in addition to strings, boolean, numbers and dates).

List attributes are useful for e.g. representing all the features a user has access to, or a list of roles they posses.

Setting list attributes (either via Userflow.js or via our REST API) is very simple:

userflow.identify(user.id, {
  features: ['flows', 'launchers', 'checklists']
})

Appending, prepending, remove list values

We even have a few new list operations (append, prepend and remove) for manipulating existing list attributes. See Userflow.js docs. Example of adding "themes" to the end of list attribute called features:

userflow.updateUser({
  features: {append: 'themes'}
})

Using list attributes in flows

When using list attributes in a condition in the builder, you can target users whose list includes “one or more of” or “all of” the given values:

list-condition

Migrating string attributes to lists

If you have existing string attributes formatted as comma-separated lists, you may want to migrate these to proper list attributes to take advantage of the better condition support.

The best way to migrate is to start writing the new list attribute to a different attribute name. Let’s say you had this before:

userflow.identify(user.id, {
  features: 'flows,launchers,checklists'
})

Then run both the old string attribute and the new list attribute side-by-side for a while. This is so your existing flows that depend on the old features attribute do not break.

userflow.identify(user.id, {
  features: 'flows,launchers,checklists',
  // Name this whatever you want, this is just an example
  features_list: ['flows', 'launchers', 'checklists']
})

Finally, you can change your content to start using the features_list attribute instead of features.

Note that it is allowed to switch the data type of existing attributes from string to list, and vice versa, but be careful:

  • When you change a string attribute to a list attribute, all existing values will become lists with 1 element containing the string value. 'a,b,c' will become ['a,b,c'] (we don’t automatically split comma-separated strings).
  • When you change a list attribute to a string attribute, all existing values will become the first element of the list (i.e. any additional elements are dropped). ['a', 'b', 'c'] will become 'a'.

🤔 Teaser

I wonder what kind of survey question list attributes could be useful for? It rhymes with Schmultiple Schelection.

More from Userflow