identify

Setting user properties (identification). Up to 250 properties can be set in one request.

Argument Description
data Required. User property operations. See format below.
options JS-object. Additional parameters for property set request
contact_souce JS-object describing contact gathering source - pop-up, chat etc.
// Simplified format:
dashly.identify({'$name': 'Maks', myProp: 'myValue'});

// Complex format:
dashly.identify([
  {op: 'add', key: 'segment1', value: 1},
  {op: 'update_or_create', key: 'segment2', value: 1},
]);

// Using additional parameters example
dashly.identify([
  {op: 'update_or_create', key: '$email', value: 'mail@example.com'},
  {op: 'add', key: 'segment1', value: '65535'}
], {
  doubleSubscribe: true,
  parseCustomPropsType: false
});

dashly.identify([
    {op: 'update_or_create', key: '$email', value: 'mail@example.com'}
  ],
  undefined,
  {
    id:'123123', type:'run_script'
  });

Simple format

Simple format should be used when you want to write a property if it does not exist or overwrite if it already exists (update_or_create - the most commonly used option). Then the data parameter is an object representing the collection of keys and values.

Complex format

You can more accurately control this behavior using the complex format. Thus, you can set a property only once (without overwriting the existing one), delete, etc.
Here, data is an array consisting of a set of operations. Description of a complex format.

Additional parameters

This method allows passing the second argument containing additional parameters:

  • doubleSubscribe Allows to resubscribe a previously unsubscribed user email. This can be used, when an $email user property is changed or created in the same dashly.identify call. In case a user's email is in "Unsubscribed" status when this method is called with doubleSubscribe: true, the user's email status will be changed to Subscribed (in case Double opt-in is active, a confirmation email will be sent and status will be changed to Awaiting confirmation)
  • parseCustomPropsType controls automatic type detection for property values passed in the method, which is on by default. For example, if a "123" string is passed without using this additional parameter, Dashly will interpret this value as an integer and 123 integer value will be written into user's property. You pass parseCustomPropsType: false additional parameter to disable this behaviour so value will retain the type (a "123" string) it was passed with in the method call upon being written into user's property.

Data collection source

Third argument can accept an object with additional parameters. This argument is used to specify the sourse of contact data in "Name/Email/Phone identified or changed" events.

  • id bot/auto/manual message id from which this contact was received
  • type type of message wрich was the source for the contact ("popup_small", "popup_big", "block_popup_small", "block_popup_big", "run_script", "auto_reply", "lead_bot", "routing_bot")

User properties and users merging

If you set properties, gathered during sign up or sign in process and use user merging at the same time, you have to call dashly.identify after dashly.auth. Making the opposite, can cause writing properties to the wrong user card.