identify

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

// 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
});

carrotquest.identify([
    {op: 'update_or_create', key: '$email', value: 'mail@example.com'}
  ],
  undefined,
  {
    id:'123123', type:'run_script'
  });
Argument Description
data Required. User properties
options Additional parameters

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.

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

This method allows passing the second argument containing additional parameters: - doubleSubscribe Allows to subscribe 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.

Third argument accepts 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: string; bot/auto/manual message id (message from which this contact was received) - type: string; type of message wich was the source for the contact ("popup_small", "popup_big", "block_popup_small", "block_popup_big", "run_script", "auto_reply", "lead_bot", "routing_bot").

If you use dashly.auth, the call to dashly.identify should be after dashly.auth.