Search...
Menu

SaleSmartly Chat Plugin JSSDK Developer Documentation

一、Introduction

After inserting the code (ssq is a global variable), you can make message changes and chat window calls by the following methods.

二、API

2.1 Set login information

You can set user information after user login, and correspondingly you can see the set information in the customer service system.

ssq.push('setLoginInfo', {
  user_id: 'b58e64cfxs2ym', // 必填,加密后的用户 id
  user_name: 'test_yy', // 必填,用户名
  language: 'ru-RU', // 插件语言
  phone: '861592014xxxx', // 手机号码务必填写完整的带有国家区号的格式;未带区号的手机号码可能会产生识别国家地区错误或被识别为无效号码。
  email: 'test@test', // 邮箱
  description: '套餐B\n客户端\n收费客户', // 描述
});

2.2 Clear user login information

You can manually clean up user login information for use in PWA sites, which is executed after logging out and not refreshing the page.

ssq.push('clearUser'); 

2.3 Open the chat window

The chat window can be opened manually with the program for some special scenarios where users can be guided to consult customer service, such as payment failure.

ssq.push('chatOpen'); 

2.4 Close the chat window

You can close the chat window manually with the program.

ssq.push('chatClose'); 

2.5 Monitor unread messages

Monitor unread messages for custom message notifications.

ssq.push('onUnRead', function(obj) {
    console.log(obj.num); // 未读数量
    console.log(obj.list); // 未读内容
});

2.6 Hide Icons

Custom icons can be implemented by combining ” monitor unread messages” and “open chat window”.

window.__ssc.setting = { hideIcon: true}; 

2.7 Monitor messages sent by visitors

Monitor visitor messages and then perform data statistics or reporting, which can be used for advertising effectiveness statistics or attribution.

ssq.push('onSendMessage', function(obj) {
    console.log(obj);
});

2.8 Listening to messages received by visitors

Monitor the information received by visitors and then perform data statistics or reporting, which can be used for advertising effectiveness statistics or attribution.

ssq.push('onReceiveMessage', function(obj) {
    console.log(obj);
});

2.9 Monitor window open

Monitor the open window, and then you perform data statistics or reporting, which can be used for advertising effectiveness statistics or attribution.

ssq.push('onOpenChat', function() {
    // 上报数据
});

2.10 Monitor window closed

Monitor the closed window and you can report data for analysis.

ssq.push('onCloseChat', function() {
    // 执行其他事件
});
Previous
How to set up SaleSmartly for Google Analytics tracking
Next
2
Last modified: 2023-03-20Powered by