Update User

Updates properties on the existing user

These operations provide you with the ability to manage the current user's data. The operations allow for additional user properties to be uploaded to ZetaHub or changed from their current values.

User Updates are blocking JavaScript calls.

bt('updateUser', properties, settings={});

The updateUser call has the following fields:

FieldTypeDescription
propertiesObjectA JSON object containing properties to add to the current user
settings optionalObjectSettings specific to this event. Currently supports specification of onComplete, onSuccess, and onFailure callback functions. See Settings below for more information.

Properties

While any JSON data can be supplied as user properties, a few properties are standardized and specially handled by Zeta's systems.

PropertyTypeDescription
first_nameStringThe first name of the user.
last_nameStringThe last name of the user.
nameStringThe full name of the user. Note that unless a user has this property set, the user's name will appear in ZetaHub as a concatenation of their first_name and last_name.
emailStringThe email address of the user.
user_idStringA unique identifier for the user.
signed_up_atISO-8601 Timestamp StringThe date at which a person signed up.
contactsArray of objectsOne or more contacts for this user. Each contact should be a hash/object with type and value attributes. A status is optional and defaults to "new". The type can be either "email" or "phone". If the type is an "email", it should satisfy standard email format validations. If the type is "phone", it should be sent in the ISO E.164 format with the "+" symbol followed by the country code and then the number. The status attribute can be used to unsubscribe the contact by sending its value as "inactive" or made active by sending its value as "active".

If a contact with the given type and value already exists for this user, it will be overwritten with the provided values. Otherwise, it will be added for this user.

Settings

The settings object is used for configuring the updateUser call.

Three settings objects are currently allowed for updateUser calls using the p13n.js library:

ObjectDescription
onCompleteThis setting allows the caller to specify a callback function once the updateUser function has completed. The function will be called regardless of whether the update to the user was successful or not. The function should have no parameters (nothing will be passed to it).
onFailure(error)This setting allows the caller to specify a callback function if the updateUser function has completed with an error. The error raised by the updateUser function will be passed into this callback.
onSuccessThis setting allows the caller to specify a callback function once the updateUser function has completed successfully. The function should have no parameters (nothing will be passed to it).
bt('updateUser', 
   {user_id: 'abcde123'}, 
   {onComplete: function() 
    { console.log('User Update Completed!'); }
   }
  );
bt('updateUser', 
   {user_id: 'abcde123'}, 
   {onFailure: function(err) 
    { console.log('Update completed with error: ' + err); }
   }
  );
bt('updateUser', 
   {user_id: 'abcde123'}, 
   {onSuccess: function() 
    { console.log('Update completed successfully!'); }
   }
  );


updateUser with LIVE ID Graph

Please see this page for more information regarding the LIVE ID Graph before getting started

PropertyTypeDescription
unique_client_idsArray of Objects.An array of objects which contain a name and value. Where name is the key corresponding to the configured name of your identifier and value is the key for the value of the identifier which belongs to the profile
bt('updateUser', 
   {"unique_client_ids":[
     {
       "name":"subscriber_id",
       "value":"A00001
     }
     ]
   }
  );
bt('updateUser', 
   {"unique_client_ids":[
     {
       "name":"subscriber_id",
       "value":"A00001
     }
     ],
    "user_id":"A123"
   }
  );

Note when using unique_client_ids in the updateUser function, it is possible to merge two existing ZMP profiles together, if you provide a primary ZMP identifier (email or user_id) and a unique_client_id when those resolve to 2 different profiles already in ZMP - if this happens the profiles will be merged and a profile_consolidation event will be visible on the profile