Categories

Categories

Track your chatbot using custom analytics

Track your chatbot using custom analytics

 
At the moment, you can track your chatbot using Google Analytics and Facebook Pixel. If you wish to track the bot using custom analytics, then you can do this using the JavaScript method collectchat.on. You can track four possible events inside the chatbot.

When chatbot widget opens

<script>
var collectchat = window.collectchat || {};
collectchat.ready = function() {
    collectchat.on('open', function() {
        console.log('User just opened the chatbot widget');
        /* Call your custom analytics function */
    });
}
</script>

When chatbot widget closes

<script>
var collectchat = window.collectchat || {};
collectchat.ready = function() {
    collectchat.on('close', function() {
        console.log('User just closed the chatbot widget');
        /* Call your custom analytics function */
    });
}
</script>

When user completes the conversation

<script>
var collectchat = window.collectchat || {};
collectchat.ready = function() {
    collectchat.on('complete', function() {
        console.log('User just completed the conversation');
        /* Call your custom analytics function */
    });
}
</script>

When user responds to a message

<script>
var collectchat = window.collectchat || {};
collectchat.ready = function() {
  collectchat.on('message', function(details) {
    console.log('User responded to question', details.question, details.answer);
    /* Call your custom analytics function */
  });
}
</script>


Still need help?

Contact us