JS API Documentation

SalesIQ JavaScript APIs

Zoho SalesIQ APIs are easy-to-use, quick-to-implement, designed to customize your Chat Widget based on your existing web presence and preferences.

Explore more about Zoho SalesIQ APIs and learn how to squeeze more power out of them for your business.

How to Use?

You need to add the required JavaScript APIs in your website along with the Zoho SalesIQ Embed Code to control the behaviour of the Chat embedded in your website.

Note:

Visitor APIs

.visitor.name()

$zoho.salesiq.visitor.name(" < NAME > ");

This API is used to fill the visitor's name in the chat widget text box.

Even if the visitor name field is hidden from the chat widget, the API can still set the visitor name and display it to the User.

Example

<script>

   $zoho.salesiq.visitor.name("John Smith");

</script>

Note:

This API can also be invoked using the Zoho SalesIQ global handler.

.visitor.email()

$zoho.salesiq.visitor.email(" < EMAIL > ");

You can use this API to fill the visitor email address in the chat widget text box.

Even if the visitor email field is hidden from the chat widget, the API can still set the visitor email address and display it to the agent.

Example

<script>

   $zoho.salesiq.visitor.email("johnsmith@zillium.com");

</script>

Note:

This API can also be invoked using the Zoho SalesIQ global handler.

.visitor.contactnumber()

$zoho.salesiq.visitor.contactnumber(" < NUMBER > ");

This API is used to fill the visitor contact number in the chat widget text box.

Even if the visitor contact number field is hidden from the chat widget, the API can still set the visitor contact number and display it to the agent.

Example

<script>

   $zoho.salesiq.visitor.contactnumber("1-541-754-3010");

</script>

Note:

This API can also be invoked using the Zoho SalesIQ global handler.

.visitor.info()

$zoho.salesiq.visitor.info({" < key1 > " : " < value1 > ", " < key2 > ": "< value2 > "});

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.visitor.info({"Band" : "Premium", "next payment": "Jan 20, 2013"});

}

</script>

This API allows you to add the additional information about the visitor and displays it to the agent in the visitor information section. These information are not visible to the visitors.

Note:

To push the values passed in the JSON object to CRM, create a new field with the same JSON key under Leads/Contacts/Visits module in CRM. Example: A JSON object {"Band" : "Premium"} will update the value as Premium, if a custom field with name Band exists in your CRM.

Parameters

key : Field name to be used.

value : Value for the fields.

.visitor.question()

$zoho.salesiq.visitor.question(" < QUESTION > ");

You can use this API to pre-fill a question in the chat widget.

Example

<script>

   $zoho.salesiq.visitor.question("I need a quote for the latest launch ");

</script>

Note:

This API can also be invoked using the Zoho SalesIQ global handler.

.visitor.customaction()

$zoho.salesiq.visitor.customaction(" < Any custom action > ");

This API will allow you to track and report the User defined custom action of the visitors in your SalesIQ. That is, SalesIQ will automatically track the pages on your website and report on the navigation path of the proactive chat, but with the help of this API you can even track the specific actions performed by the visitor in a page.

This API is not meant only for Onclick actions, but can be used anywhere in the page.

Example:1

<script>

$zoho.salesiq.ready=function(embedinfo) {    $zoho.salesiq.visitor.customaction("Track-Signup-button"); }

</script>

Example:2

<a onclick='$zoho.salesiq.visitor.customaction("Track-signup-button")'> SignUp </a>

Chat APIs

.chat.mode()

$zoho.salesiq.chat.mode("< click|none >");

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.mode("click");

}

</script>

Use this API if you need the chat to be initiated OnClick over the chat button. However it will work only if all required visitor informations are populated.

Parameters

click : Initiate a chat OnClick.

none : To clear the OnClick Event.

.chat.department()

$zoho.salesiq.chat.department([" < DEPARTMENT1 > " , " < DEPARTMENT2 > "]);

Example

<script>

   $zoho.salesiq.chat.department(["Sales","Support","Marketing"]);

</script>

Note:

This API can also be invoked using the Zoho SalesIQ global handler.

This API allows you to display only the required departments in the pre-chat form. All other configured departments will be hidden regardless of their status. However Web Embed department settings should be configured as "Allow user to select department".

Parameters

online.department : To display only the online departments.

.chat.defaultdepartment()

$zoho.salesiq.chat.defaultdepartment(" < DEFAULT DEPARTMENT > ");

This API allows you to set a default department in the pre-chat form and the visitors are allowed to select other department if needed. However Web Embed department settings should be configured as "Allow user to select department".

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.defaultdepartment("Sales");

}

</script>

.chat.agent()

$zoho.salesiq.chat.agent(" < DEFAULT AGENT > ");

Use this API to route the chat to a specific agent for the first half of the waiting time. If not picked, the chat will be routed to other available agents.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.agent("Johny.deskey@zillium.com");

}

</script>

.chat.forward()

$zoho.salesiq.chat.forward(<false>);

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.forward(false);

}

</script>

Use this API to disable chat forwarding to other agents. If the assigned agent could not pick the chat within the first half of the waiting time, these chats will not be forwarded to other agents and will be added under missed.

Parameters

false : To route the chats to a specific agent.

Note:

This API Can be used only for Personalized chat option and while using the API to set a default agent with the API "$zoho.salesiq.chat.agent".

.chat.title()

$zoho.salesiq.chat.title(" < TITLE > ");

This API allows you to set title for the chat. Disable the company logo in Web Embed settings to get the title displayed for Chat window, Float & Personalized Chat widget.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.title("Ebay.in");

}

</script>
$zoho.salesiq.chat.logo(" < LOGO > ");

This API allows you to set logo for the chat widget. Make sure to enable the company logo in the Web Embed settings.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.logo("Logo URL");

}

</script>

.chat.start()

$zoho.salesiq.chat.start();

You can use this API to initiate a chat, it should be invoked only on a JavaScript OnClick. Supported for all the type of embed.

Example

<span  onclick="javascript:$zoho.salesiq.chat.start()" > Chat with us  </span>

Note:

This API will not work if it is not invoked using the JavaScript OnClick.

.chat.complete()

$zoho.salesiq.chat.complete();

You can use this API to end the chat; it should be invoked on the JavaScript OnClick.

Example

<span  onclick="javascript:$zoho.salesiq.chat.complete()" > Thank you for contacting us!  </span>

Note:

This API will not work if it is not invoked using the JavaScript OnClick.

.chat.systemmessages()

$zoho.salesiq.chat. systemmessages ({" < FIELD > ":" < MESSAGE > "});

You can use this API to customize the system messages displayed in the chat widget.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

  $zoho.salesiq.chat.systemmessages({"waiting":" Please wait while we connect you to the support representative"});

  $zoho.salesiq.chat.systemmessages({"offline":"Sorry, We are not available at the moment"});

  $zoho.salesiq.chat.systemmessages({"busy":"Sorry, All the agents are busy right now, Please try again later"});

  $zoho.salesiq.chat.systemmessages({"busycomplete":"Thanks for submitting your details, WIll call you back"});

  $zoho.salesiq.chat.systemmessages({"engaged": "Sorry! All the users are engaged in supporting other customers." });

  $zoho.salesiq.chat.systemmessage({"engagedcomplete": "Thanks for submitting your details, You will hear from us shortly",});

  $zoho.salesiq.chat.systemmessages({"prechatmessage":"Welcome to Zoho SalesIQ. How can we help you "});

  $zoho.salesiq.chat.systemmessages({"feedbackcomplete1":"Sorry, will improve our support"});

  $zoho.salesiq.chat.systemmessages({"feedbackcomplete2":"Please provide us your suggestion"});

  $zoho.salesiq.chat.systemmessages({"feedbackcomplete3":"Thanks for your feedback!"});

  $zoho.salesiq.chat.systemmessages({"feedbackcomplete4":"Thank you for your time"});

  $zoho.salesiq.chat.systemmessages({"feedbackcomplete5":"Wow Thanks"});

  $zoho.salesiq.chat.systemmessages({"agentinfomessage":"Would you need any help?"});

}

</script>

Parameters

waiting : This message will be displayed when a visitor is waiting after initiating the chat.

offline : This message will be displayed when all of your agents are in offline mode.

busy : This message will be displayed to the visitors when all your agents are busy and the chat waiting time has expired.

busycomplete : This message will be displayed to the visitors after submitting their request when all the agents are busy.

engaged : When the number of concurrent chats for a user reaches the configured ‘User concurrent chat limit’, the status of the user will be set as Engaged. Set the message to be displayed for the visitors when all the users are engaged.

engagedcomplete : When the visitor is displayed with the engaged status message, he also has an option to register for a response. Once he submits his details for a response, this message will be displayed to him.

prechatmessage : This message will be displayed to the visitor before initiating the chat when Name, Email address and Contact number field are hidden in the chat widget.

feedbackcomplete : This message will be displayed to your visitors after submitting the feedback. Feedbacks are scaled from one to five, you can have your own specific text for each level.

Feedbackcomplete1
Feedbackcomplete2
Feedbackcomplete3
Feedbackcomplete4
Feedbackcomplete5

agentinfomessage : This message will be displayed in the "User Description Area" of the Personalized Chat Window. (Note: It's applicable only for Personalized Chat Window)

.salesiq.language()

$zoho.salesiq.language(" < LANGUAGE CODE > ");

This API allows you to set a language for the Chat Widget. Make sure you enter the code in the LANGUAGE CODE variable.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.language("pt");

}

</script>

Parameters

.chat.theme()

$zoho.salesiq.chat.theme('black | gray | blue | green | red | purple');

This API allows you to customize your theme color.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.theme('purple');

}

</script>

Chat Bubble API

.chatbubble.visible()

ZohoSalesIQ.Admin.storeHistory(true/false)

This event handler allows you to invoke a method when the visitor uses your application.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatbubble.visible("show");

}

</script>

Parameters

show : To display your chat bubble.

hide : To hide your chat bubble.

delayinsecs : To delay the chat bubble display. Enter the seconds to introduce a delay in display.

.chatbubble.animate()

$zoho.salesiq.chatbubble.animate(" < timeinsecs > ");

Use this API to increase or decrease the chat bubble animation time. Make sure to enable the chat bubble in WebEmbed settings.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatbubble.animate("2");

}

</script>

Parameters

timeinsecs : Time should be set to a minimum of 1 sec to have delay in animation.
Setting up -1 will stop the chat bubble animation.

.chatbubble.src()

$zoho.salesiq.chatbubble.src(" < IMAGE SOURCE > ");

You can use this API to set the chat bubble image. The recommended size for the chat bubble is 90px*90px. Make sure to enable the chat bubble in WebEmbed settings.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatbubble.src("https://www.zoho.com/salesiq/img/Zilliumonline.png");

}

</script>

Chat Button APIs

.chatbutton.texts()

$zoho.salesiq.chatbutton.texts([[" < ONLINE MESSAGE > ", "<Online>"], [" < OFFLINE MESSAGE > ", "<Offline>"]]);

This API allows you customize the online and offiline text. Supported for Embed Button & Float Chat.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatbutton.texts([["Hello, How can i help you ?", "Online"], ["Leave your message", "Offline"]]);

}

</script>

Parameters

ONLINE MESSAGE : To display the first line text in the online Button.

OFFLINE MESSAGE : To display the first line text in the offline Button.

Online : To display the second line text in the online Button.

Offline : To display the second line text in the offline Button.

Note:

For Float Chat, only the first line text is displayed.

.chatbutton.icon()

$zoho.salesiq.chatbutton.icon( " < ICON > ");

Note: To display an icon in the chat button, select a number from 1 to 6.

This API allows you to choose an icon from Zoho SalesIQ stock. Supported for Embed Button & Float Chat.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatbutton.icon("6");

}

</script>

.chatbutton.visible()

$zoho.salesiq.chatbutton.visible(" show|hide|delayinsecs ");

This API allows you to handle the visibility of Chat Button. Supported only for Embed Button.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatbutton.visible("show");

}

</script>

Parameters

show : To display the Chat Button.

hide : To hide the Chat Button.

delayinsecs : To delay the Chat Button display. Enter the seconds to introduce a delay in display.

.chatbutton.onlineicon()

$zoho.salesiq.chatbutton.onlineicon.src(" < ONLINE ICON SOURCE > ");

You can use this API to display your own icon when your agents are online. Supported only for Embed Button.

Image Size: 18*16 (Height*Width)

Image File Format: All types of image file format will be supported. The PNG transparency file format is highly recommended to increase image clarity.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatbutton.onlineicon.src("https://www.zoho.com/salesiq/img/Zilliumonline.png");

}

</script>

.chatbutton.offlineicon()

$zoho.salesiq.chatbutton.offlineicon.src(" < OFFLINE ICON SOURCE > ");

You can use this API to display your own icon when your agents are offline. Supported only for Embed Button.

Image Size: 18*16 (Height*Width)

Image File Format: All types of image file format will be supported. The PNG transparency file format is highly recommended to increase image clarity.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatbutton.offlineicon.src("https://www.zoho.com/salesiq/img/ZilliumOffline.png");

}

</script>

.chatbutton.width()

$zoho.salesiq.chatbutton.width( "< WIDTH >" );

This API allows you to define the width of the Chat Button in pixels. Supported only for Embed Button.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatbutton.width("100");

}

</script>

.chatwindow.visible()

$zoho.salesiq.chatwindow.visible (" show|hide|delayinsecs ");

This API allows you to handle the visibility of Chat Window. Supported only for Chat Button.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatwindow.visible("hide");

}

</script>

Parameters

show : To display the Chat window.

hide : To hide the Chat window.

delayinsecs : To delay the Chat Window display. Enter the seconds to introduce a delay in display.

Float Button APIs

.floatbutton.position()

$zoho.salesiq.floatbutton.position(" topright|topleft|bottomright|bottomleft|right|left ");

You can use this API to position the Float Button.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.floatbutton.position("left");

}

</script>

Parameters

topright : Float button will be aligned to the top right.

topleft : Float button will be aligned to the top left.

bottomright : Float button will be aligned to the bottom right.

bottomleft : Float button will be aligned to the bottom left.

right : Float button will be aligned to the right.

left : Float button will be aligned to the left.

.floatbutton.onlineicon.src()

$zoho.salesiq.floatbutton.onlineicon.src(" < ONLINE ICON SOURCE > ");

This API allows you to track the custom actions performed by the visitors in the mobile application.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.floatbutton.onlineicon.src("https://www.zoho.com/salesiq/img/Zilliumonline.png");

}

</script>

.floatbutton.offlineicon.src()

$zoho.salesiq.floatbutton.offlineicon.src(" < OFFLINE ICON SOURCE > ");

This API allows you to display your own icon when your agents are offline. Supported only for Float Button.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.floatbutton.offlineicon.src("https://www.zoho.com/salesiq/img/ZilliumOffline.png");

}

</script>

.floatbutton.visible()

$zoho.salesiq.floatbutton.visible(" show|hide|delayinsecs ");

This API alllows you to handle the visibility of Float Button. Supported only for Float Button.

Example

<script>
   $zoho.salesiq.floatbutton.visible("hide");
</script>

Note:

This API can also be invoked using the Zoho SalesIQ global handler.

Parameters

show : To display the Float Button.

hide : To hide the Float Button.

delayinsecs : To delay the Float Button display. Enter the seconds to introduce a delay in display.

.floatwindow.visible()

$zoho.salesiq.floatwindow.visible(" show|hide|delayinsecs ");

This API allows you to handle the visibility of the Float Chat Window. Supported only for Float.

Example

<script>
   $zoho.salesiq.floatwindow.visible("4");
</script>

Note:

This API can also be invoked using the Zoho SalesIQ global handler.

Parameters

show : To display the Float Window.

hide : To hide the Float Window.

delayinsecs : To delay the Float Window display. Enter the seconds to introduce a delay in display.

Feedback APIs

.feedback.visible()

$zoho.salesiq.feedback.visible(" show|hide ");

This API allows you to handle the visibility of feedback form, on completion of a chat.

Example

<script>
    $zoho.salesiq.feedback.visible("hide");
</script>

Parameters

show : To display the feedback section on completion of a chat.

hide : To hide the feedback section on completion of a chat.

.rating.visible()

$zoho.salesiq.rating.visible(" show|hide ");

Use this API to handle the visibility of rating, on completion of a chat.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.rating.visible("show");

}

</script>

Parameters

show : To display the rating section on completion of a chat.

hide : To hide the rating section on completion of a chat.

Custom APIs

.custom.html()

$zoho.salesiq.custom.html("< container >", {
"online.html" :"<img src = 'ONLINE HTML CODE' >",
"offline.html" :"<img src = 'OFFLINE HTML CODE' >",
"online.click" :function(){},
"offline.click" :function(){},

};

API allows you to have your own customized chat button. Supported for Float Chat and Embed Button.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.custom.html("salesiqchat",{"online.html":"<img src ='https://www.zoho.com/salesiq/img/Zilliumonline.png'>", "offline.html":"<img src ='https://www.zoho.com/salesiq/img/ZilliumOffline.png'>"});

}

</script>

Parameters

container : Mention the Div Id, where you would like to position the embed.

online.html : html given here will be displayed when your agents are online.

offline.html : html given here will be displayed when your agents are offline.

online.click : Specify the function to be invoked OnClick of the customized chat button when the agents are online.

offline.click : Specify the function to be invoked OnClick of the customized chat button when the agents are offline.

Note:

Your customized chat image will be displayed where the container Div is positioned.

.customfield.add()

$zoho.salesiq.customfield.add(
{
   "name" :"<Name of the field>",
   "hint" :"<Hint for the field>",
   "required" :"<true|false>",
   "maxlength" :"<Integer (0-100)>",
   "type" :"<type of field ">",
   "visibility" :"<online|offline|both>",
   "options" : [{
     "text" :"<Text>",
     "value":"<Value>"
   }]
});

Allows you to create a new input field in the chat widget. Custom field inputs will be dispayed in visitor information section.

Note:

To push the inputs of the newly created Custom field to CRM, create a new field with the same Custom field name under the Leads/Contacts/Visits module in CRM.

Example

<script>

$zoho.salesiq.ready = function(embedinfo)

{

   $zoho.salesiq.customfield.add(

   {

      "name":"Browser",       "hint":"Browser",       "type":"checkbox",       "options":[

      {

         "text":"Chrome",          "value":"Chrome"

      },

      {

         "text":"Firefox",          "value":"Firefox"

      },

      {

         "text":"IE",          "value":"Internet Explorer"

      }],

      "required":"true",       "visibility":"both",       "callback":function(value){ }

   });

}

</script>

Parameters

name : To set reference name of the field, which will be displayed in the visitor information section for the Agents.

hint : Text to be displayed as a hint for the visitor in chat widget.

type : Type of field to be added.
" text, number, label, checkbox, radio, email, selectbox, percentage, decimal, url, textarea "

required : To make the field information mandatory.
true  :   Mandatory
false  :   Optional

maxlength : Number of characters allowed. The default value is 30 and the maximum is 100.

visibility : To display the visibility of the fields. Default value is both.
online   :   Field will be visible only when the agents are online.
offline   :   Field will be visible only when the agents are offline.
both   :   Field will be visible always.

options : To provide option for the fields. Supported only for selectbox, checkbox & radio.
text   :   Label to be displayed for the visitor.
value   :   Value to be displayed for the agent in the visitor information.

Style : To set a style for the label. This option applicable for label.
font-size   :   To set the font size for a label.
color   :   To set the font color for a label.
textAlign   :   To set the font alignment for a label

before : To position the label before a specific field.
Specify the name of the field where you would like to include.This option applicable for label.

after : To position the label after a specific field.
Specify the name of the field where you would like to include.This option applicable for label.

callback : Specify the function to be invoked when a value is set for the field.

.customfield.clear()

To clear specific field:

$zoho.salesiq.customfield.clear([" < NAME1 > " ," < NAME2 > " ]);
To clear all fields:
$zoho.salesiq.customfield.clear();

This API allows you to remove a specific or all the custom fields from the chat widget.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.customfield.clear([“browse”]);

}

</script>

Tracking APIs

.tracking.on()

$zoho.salesiq.tracking.on();

This API allows you to enable tracking in your website.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.tracking.on();

}

</script>

.tracking.off()

$zoho.salesiq.tracking.off();

This API allows you to disable tracking in your website.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.tracking.off();

}

</script>

.visitor.idleTime()

$zoho.salesiq.visitor.idleTime("

This API allows you to define a time for idle status of your website visitors.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.visitor.idleTime(10);

}

</script>

Parameters

Time : Set your time in minutes i.e (1,2,9,etc).

Note:

Default value is set to 30 minutes.

.tracking.domain()

$zoho.salesiq.tracking.domain("<parent domain>");

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.tracking.domain("zoho.com");

}

</script>

This API allows you to track the website visitor’s data across domain and its sub-domain.

For example, you have two URLs and would like to track as a single entity. Like, www.mail.zoho.com and www.chat.zoho.com.

Then specify the parent domain as explained in the example, and track both the website visitor’s data.

Note

This API will not work for the public suffix like .com, .co, .uk, etc.

To know about the public suffix, which will not work with this API, click here.

Visitor Event Handlers

.visitor.chat()

$zoho.salesiq.visitor.chat(function(visitid,data){});
"visitid" : "<Visitor id>","data" :
{
 "name" : "<Visitor name>",
 "email" : "<Visitor email>",
 "question" : "<Visitor question>",
 "visitid" : "<Visitor id>"
}

This event handler allows you to invoke a method, when a visitor initiates the chat.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.visitor.chat(function(visitid,data)

   {

      TrackinMyApplication(data.name,data.email,data.question,data.visitid);

   });

}

</script>

Parameters

visitid : Unique ID generated for the visitor.

data : Visitor information.

name : Name of the visitor.

email : Email address of the visitor.

question : Visitor question on initiating a chat.

visitid : Unique ID generated for the visitor.

Note

This event will be triggered only when the visitor initiates a chat.

.visitor.missed()

$zoho.salesiq.visitor.missed(function(visitid,data){});
"visitid" : "<visitor id>","data" :
{
 "name" : "<Visitor name>",
 "email" : "<Visitor email>",
 "question" : "<Visitor question>",
 "visitid" : "<Visitor id>"
}

This event handler allows you to invoke a method, when the chat is missed.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.visitor.missed(function(visitid,data)

   {

      TrackinMyApplication(data.name, data.email, data.question, data.visitid);

   });

}

</script>

Parameters

visitid : Unique ID generated for the visitor.

data : Visitor information.

name : Name of the visitor.

email : Email address of the visitor.

question : Missed visitor question.

visitid : Unique ID generated for the visitor.

Note

This event will be triggered only when the visitor chat is missed.

.visitor.offlineMessage()

$zoho.salesiq.visitor.offlineMessage(function(visitid,data){});
"visitid" : "<Visitor id>","data" :
{
 "name" : "<Visitor name>",
 "email" : "<Visitor email>",
 "question" : "<Visitor question>",
 "visitid" : "<Visitor id>"
}

This event handler allows you to invoke a method on submitting an offline request.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.visitor.offlineMessage(function(visitid,data)

   {

      TrackinMyApplication(data.name, data.email, data.question, data.visitid);

   });

}

</script>

Parameters

visitid : Unique ID generated for the visitor.

data : Visitor information.

name : Name of the visitor.

email : Email address of the visitor.

question : Offline request submitted by the visitor.

visitid : Unique ID generated for the visitor.

Note

This event will be triggered only when your agents are offline.

.visitor.rating()

$zoho.salesiq.visitor.rating(function(visitid,data){});
"visitid" : "<Visitor id>","data" :
{
 "agent" : "<Agent email address>",
 "rating" : "<Agent rating>",
 "visitid" : "<Visitor id>"
}

This event handler allows you to invoke a method, when a visitor rates the support session.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.visitor.rating(function(visitid,data)

   {

      TrackinMyApplication(data.agent,data.rating,data.visitid);

   });

}

</script>

Parameters

visitid : Unique ID generated for the visitor.

data : Agent rating information.

agent : The email address of an agent who attends the chat.

rating : Rating given by the visitor to the agent who attended the chat.

Note

This event will be triggered only when the visitor rates the chat support session.

.visitor.feedback()

$zoho.salesiq.visitor.feedback(function(visitid,data){});
"visitid" : "<Visitor id>","data" :
{
 "visitid" : "<Visitor id>",
 "feedback" : "<Visitor feedback message>",
 "agent" : "<Agent email address>"
}

This event handler allows you to invoke a method on submitting the feedback message.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.visitor.chat(function(visitid,data)

   {

      TrackinMyApplication(data.name,data.email,data.question,data.visitid);

   });

}

</script>

Parameters

visitid : Unique ID generated for the visitor.

data : Visitor feedback message information.

feedback : Feedback given by the visitor to the agent who attended the chat.

agent : The email address of an agent who attends the chat.

.visitor.idle()

$zoho.salesiq.visitor.idle(function(){});

Note: This event will be triggered only when the visitor turns to idle state.

This event handler allows you to invoke a method, when the visitor turns to idle state.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.visitor.idle(function()

   {

     #insert your code here

   });

}

</script>

.visitor.active()

$zoho.salesiq.visitor.active(function(){});

Note: This event will be triggered once the visitor resumes to an active state from idle.

This event handler allows you to invoke a method, when the visitor resumes to an active state from idle.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.visitor.active(function()

   {

     #insert your code here

   });

}

</script>

.visitor.trigger()

$zoho.salesiq.visitor.trigger(function (triggername, visitorinfo);

{

   // Your code here

});

Here, the triggername and the visitorinfo is passed as the parameter to this method.

Allows invoking your own custom trigger in the visitor’s landing page, if the visitor matches the configured condition.

To do so:

  1. Implement this JS API in your website.
  2. Set a rule for which the API should be triggered in the Settings -> Automation -> Intelligent Triggers and choose the Invoke JS API option in the Select an Option dropdown.
  3. The API will be invoked when the visitor matches the rule. If trigger name is mentioned in the textbox then it will be passed as a parameter to the method. The second parameter contains available visitor information.

Example

In this example, two different rules are set by the user in the Settings -> Automation -> Intelligent Triggers. The Invoke JSAPI option is chosen from the Select an Option drop down and then the trigger name is mentioned in the text box as shown in the below screenshot.

In the first rule, the user wants to trigger some custom action and engage the visitor, who have visited the website more than 10 times but never initiated a chat.

In the second rule, the user wishes to display a discount banner only to the CRM users, who have CRM potentials closing this month.

Then, the following JS API is implemented in the website:

<script>

$zoho.salesiq.ready = function (embedinfo)

{

   $zoho.salesiq.visitor.trigger(function (triggername, visitorinfo)

   {

     if (triggername == 'Engage')

     {

       engageReturningVisitor(); // Implement your custom action here

     }

     else if (triggername == 'Show Discount Banner')

     {

       showDiscountBanner(); // Implement your custom action here

     }

   });

// other JSAPIs here

}

</script>

Parameters

triggername : Configured trigger name in the rule.

visitorinfo : This JSON object contains the details of the visitor that are available from the following list:

Chat Event Handlers

.chat.online()

$zoho.salesiq.chat.online(function(){});
Note: This event will be triggered only when the agents are online.

This event handler allows you to invoke a method, when the agents are online. This will be called once after the page is loaded.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.online(function()

   {

     #insert your code here

   });

}

</script>

.chat.offline()

$zoho.salesiq.chat.offline(function(){});
Note: This event will be triggered only when the agents are offline.

This event handler allows you to invoke a method, when the agents are offline. This will be called once after the page is loaded.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.offline(function()

   {

     #insert your code here

   });

}

</script>

.chat.attend()

$zoho.salesiq.chat.attend(function(visitid,data){});
"visitid" : "<Visitor id>","data" :
{
  "attendername" : "<Agent name>",
 "attenderemail" : "<Agent email address>",
 "visitid" : "<Visitor id>"
}

This event handler allows you to invoke a method, when an agent attends the chat.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.attend(function(visitid,data)

   {

      TrackinMyApplication(data.attendername, data.attenderemail, data.visitid);

   });

}

</script>

Parameters

visitid : Unique ID generated for the chat.

data : Agent information.

attendername : The name of an agent who attends the chat.

attenderemail : The email address of an agent who attends the chat.

Note

This event will be triggered only when an agent attends the chat.

.chat.agentMessage()

$zoho.salesiq.chat.agentMessage(function(visitid,data){});
"visitid" : "<Visitor id>","data" :
{
  "visitid" : "<Visitor id>",
 "message" : "<Chat message>",
}

This event handler allows you to invoke a method, when a message is sent to the visitor by the agent.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.agentMessage(function(visitid,data)

   {

      TrackinMyApplication(data.visitid,data.message);

   });

}

</script>

Parameters

visitid : Unique ID generated for the chat.

data : Agent chat message information.

message : The message sent to the visitor by the agent.

Note

This event will be triggered for all the messages sent to the visitor by the agent.

.chat.complete()

$zoho.salesiq.chat.complete(function(visitid,data){});
"visitid" : "<Visitor id>","data" :
{
  "visitid" : "<Visitor id>",
 "chatduration" : "<Total chat duration time>",
}

This event handler allows you to invoke a method, when a chat session is completed.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.complete(function(visitid,data)

   {

      TrackinMyApplication(visitid,data.chatduration);

   });

}

</script>

Parameters

visitid : Unique ID generated for the chat.

data : Chat session information

chatduration : Total chat duration time in minutes.

Note

This event will be triggered only when the chat session is completed.

.chat.transferchat()

$zoho.salesiq.chat.transferchat(function(visitid,data){});
"visitid" : "","data" :
{
  "currentuser" : "<name of the user transfering the chat>",
  "transfertype" : "<chat transfer type (user/Department)>",
  "transfername" : "<name of the user/depatment the chat is being transfered>",
  "visitid" : "<visitor id>"
}

This event handler will be triggered, when the user transfers a chat.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.transferchat(function(visitid,data)

   {

      TrackinMyApplication(data.currentuser,data.transfertype,data.transfername,data.visitid);

   });

}

</script>

Parameters

visitid : Unique ID generated for the chat.

data : Visitor information.

chat.accepttransfer()

$zoho.salesiq.chat.accepttransfer(function(visitid,data){});
"visitid" : "<Visitor id>","data" :
{
 "attendername" : "<name of the user who accept the transferred chat>",
 "attenderemail" : "<email id of the user accepting the chat>",
 "department" : "<department of the user accepting the chat>",
 "visitid" : "<visitor id>"
}

This event handler will be triggered, when the user accepts the transferred chat request.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.accepttransfer(function(visitid,data)

   {

      TrackinMyApplication(data.attendername,data.attenderemail,data.department,data.visitid);

   });

}

</script>

Parameters

visitid : Unique ID generated for the chat.

data : Chat session information

UI Event Handlers

.chat.waitinghandler()

$zoho.salesiq.chat.waitinghandler(function(data){});
"data" :
{
  "waitingtime" : "<Configured waiting time>",
 "currenttime" : "<Current waiting time>",
}

This event handler allows you to invoke a method to display your own content in the chat widget's waiting timer.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chat.waitinghandler(function(data)

   {

      if(data["waitingtime"]!=data["currenttime"]);

      {

        return "";

      }

      return'<iframewidth="250"height="250"src="//www.youtube.com/embed/3RD_3wooRjI?rel=0&autoplay=1" frameborder="0" allowfullscreen>';

   });

}

</script>

Parameters

data : Waiting time

waitingtime : The waiting time configured in your web embed settings.

currenttime : Current waiting time in seconds.

Return Values

return ""; : Waiting timer will not be displayed in the chat widget.

return '<value>'; : Current waiting time in seconds.

Example

return 'Welcome! Thank you for visiting our Live Chat support';

return '<b>Welcome! Thank you for visiting our Live Chat support</b>';

return '<img src ='https://www.zoho.com/salesiq/img/Zilliumonline.png>';

.chatbutton.click()

$zoho.salesiq.chatbutton.click(function(){});
Note: This event will be triggered only when the visitor clicks the chat button.

This event handler allows you to invoke a method on clicking the chat button.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.chatbutton.click(function()

   {

     #insert your code here

   });

}

</script>

.floatbutton.click()

$zoho.salesiq.floatbutton.click(function(){});
Note: This event will be triggered only when the visitor clicks the float button.

This event handler allows you to invoke a method on clicking the float button.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.floatbutton.click(function()

   {

     #insert your code here

   });

}

</script>

.floatwindow.minimize()

$zoho.salesiq.floatwindow.minimize(function(){});

This event handler allows you to invoke a method on minimizing the float window.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.floatwindow.minimize(function()

   {

     #insert your code here

   });

}

</script>

.floatwindow.close()

$zoho.salesiq.floatwindow.close(function(){});

This event handler allows you to invoke a method on closing the float window.

Example

<script>

$zoho.salesiq.ready=function(embedinfo)

{

   $zoho.salesiq.floatwindow.close(function()

   {

     #insert your code here

   });

}

</script>