KODA.AI Docs

KODA.AI Docs

  • Web JS SDK

›

  • Quick Start
  • Config

    • User Profile
    • Locales
    • Advanced Configuration
  • Browser Compatibility
  • SDK Methods
  • Analytics
  • CSS Properties

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:

Stat Event 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

EventPropertiesDescription
web.chatbot.button.click
  • user_locale
web.chatbot.promoMessage.show
  • user_locale
web.chatbot.promoMessage.hide
  • user_locale
web.chatbot.promoMessage.clickOpen
  • user_locale
web.chatbot.promoMessage.clickClose
  • user_locale
web.chatbot.chat.show
  • user_locale
web.chatbot.chat.hide
  • user_locale
web.chatbot.chat.voice.startRecording
  • user_locale
web.chatbot.chat.voice.stopRecording
  • user_locale
web.chatbot.chat.voice.clickMicrophoneIcon
  • user_locale
web.chatbot.chat.message.user
  • message_type(enum): text , audio, file, video, image
  • message(text)
  • fileUrl(text)
User sent a message to chatbot
web.chatbot.chat.message.chatbot
  • message_type(enum): text , audio, file, video, image, generic-template
  • message(text)
  • fileUrl(text
Chatbot sent a message
web.chatbot.chat.message.moderator
  • message_type(enum): text , audio, file, video, image, generic-template
  • message(text)
  • fileUrl(text
Moderator sent a message
web.chatbot.chat.feedback.helfull
  • user_locale
web.chatbot.chat.feedback.unhelpful
  • user_locale
web.chatbot.chat.persistentMenu.clickIcon
  • user_locale
web.chatbot.chat.persistentMenu.clickItem
  • user_locale
← SDK MethodsCSS Properties →
  • Example
  • Custom Stat Events
  • System Stat Events
Copyright © 2025 KODA sp. z o.o . Questions? Sent message to developers@koda.ai