How to update user attributes with Javascript

There might be cases where you want to update user attributes with specific values.

For example if user inputs city or checks whether they are male or female. You can easily pass this to our system from client side (using browser javascript). The event is “update” following the attributes that will be updated.

Note that email address could not be updated that way.

Almost any user attribute can be updated, the only requirement would be to pass valid value according to each attribute data type. (if attribute has numeric values do not send text).

For date attributes we try to identify the most common date formats:

  • text “2014-11-11T18:28:50.588Z”, “21 Jun 2018”, “2018/09/11”
  • timestamp¬†574156800 (is best to use timestamp in seconds)

Also, this will not work if used under admin panel or where client is not identified using its unique identifiers.

_vteq.push({"update":{"city": "London", "isCustomer": true}});

Related Articles