Initialization settings (ConveadSettings)
ConveadSettings is a global object (a synonym for window.ConveadSettings) with the Convead settings that are required to initialize the JS application on the site.
Available values of object variables:
- visitor_uid – UID of the registered user (not specified for guests).
- visitor_info – object with information about the visitor. If some data is missing, it does not need to be declared at all in this object, otherwise it will replace the existing data in Convead.
- onload – method called after the script is loaded before initialization.
- onready – method called at the time of initialization.
- onevent – method called at the moment of sending any event. Accepted variables: event_name (event name), properties (properties), visitor_info (user information), attributes (additional attributes).
- disable_chat – if true, disables chat.
- disable_auto_event_link – if true, disables the automatic sending of the “Link” event.
- disable_state_event_link – if true, disables sending the “Link” event when changing page address using JS without physically reloading the page.
- app_key – the APP key of the application. Unique to each account; it is required to specify this.
Example of all possible settings:
<code><code>window.ConveadSettings = { visitor_uid: "12345678", visitor_info: { first_name: "John", last_name: "Smith", email: "john_smith@example.com", phone: "8-800-000-000", date_of_birth: "1974-07-30", gender: "male", my_custom_numeric_property: 1234, my_custom_string_property: "foo", my_custom_date_property: "2014-04-20", my_custom_boolean_property: "true" }, app_key: "xxxxxxxxx", onload: function() { console.log('Convead onload'); }, onready: function() { console.log("Convead initialized"); }, onevent: function(event_name, properties, visitor_info, attributes) { console.log('Was sent event: '+ event_name); }, disable_auto_event_link: true, disable_state_event_link: true, disable_chat: true };
Example of settings for a registered user:
<code><code>window.ConveadSettings = { visitor_uid: "12345678", visitor_info: { first_name: "John", email: "john_smith@example.com" }, app_key: "xxxxxxxxx" };
Example of settings for a guest:
<code><code> window.ConveadSettings = { app_key: "xxxxxxxxx" };