Analytics
The SDK broadcasts events that will allow you to integrate a web widget with an external analytics tool e.g. Google Analytics
Example
<script>
window.initKBWebSDK = function (SDK) {
const bot = SDK.initKBChatbot({
"token": "TOKEN"
});
// subscribe to all events
SDK.on('*', function(event) => {
console.log(event.type);
console.log(event.properties)
});
// subscribe only for aspecific event
SDK.on('web.chatbot.load', function(properties) {
console.log(properties)
});
}
</script>
Custom Stat Events
You can subscribe to handle stat events set in the dashboard. E.g. when You add action:
You can handle this event using:
// subscribe to stat events events
SDK.on('web.chatbot.chat.statEvent', function(event) => {
console.log(event.type); // Lead Email
console.log(event.properties) // {email: "", origin: ""}
});
System Stat Events
Event | Properties | Description |
---|---|---|
web.chatbot.button.click |
| |
web.chatbot.promoMessage.show |
| |
web.chatbot.promoMessage.hide |
| |
web.chatbot.promoMessage.clickOpen |
| |
web.chatbot.promoMessage.clickClose |
| |
web.chatbot.chat.show |
| |
web.chatbot.chat.hide |
| |
web.chatbot.chat.voice.startRecording |
| |
web.chatbot.chat.voice.stopRecording |
| |
web.chatbot.chat.voice.clickMicrophoneIcon |
| |
web.chatbot.chat.message.user |
| User sent a message to chatbot |
web.chatbot.chat.message.chatbot |
| Chatbot sent a message |
web.chatbot.chat.message.moderator |
| Moderator sent a message |
web.chatbot.chat.feedback.helfull |
| |
web.chatbot.chat.feedback.unhelpful |
| |
web.chatbot.chat.persistentMenu.clickIcon |
| |
web.chatbot.chat.persistentMenu.clickItem |
|