Personalize every conversation by storing and re-using visitor data.

Each time a visitor enters your website is counted as a visit. A visitor session includes all of a visitor's activities ranging from the first page view to the last activity that he or she does before exiting the website.So, how do you keep track of all the activities of this visitor and the details that he shares during the session? The visitorsession API is used to store values temporarily during a chat conversation with the website visitor.

For example, if you want to perform an action like triggering a message to the visitor based on the time he had logged in to the website, you can set/get the visitor's logged in time during your conversation with the visitor using the visitorsession API.

Let me elaborate on this with another example.

Say, you are the owner of an online clothing store. A visitor lands your website and starts looking for clothes. The bot sends him a welcome message and offers to guide him through the products available on the site. It asks for his size so that it can display relevant options. When he enters his size, the list of clothes that match the given size are displayed. This data can be stored during the course of the conversation using the visitorsession API and used during a later part of the conversation so that the visitor does not have to enter the same data time and again.


visitorsession APIs:

zoho.salesiq.visitorsession.set($screenname,{"name":"Patricia Boyle"});


Sample Code:

msg = message.get("text");
response = Map();

//Get values
sessionvalue = zoho.salesiq.visitorsession.get("zylkerinc","size");
data = sessionvalue.get("data");
size = data.get("size");
response.put("replies", {"We have found the following for you and you'll love it for sure"});

//Set values
  size = answers.get("size").get("text");
  zoho.salesiq.visitorsession.set("screenname",{"size": size});
  response.put("replies", {"Please select a category"});
  response.put("suggestions", {"Winter wear","Summer wear"});
  return response;



The values stored inside the visitor session API will be available only till the end of the ongoing chat.

To learn more about the visitorsession API, click here.

Return to Tips