At the moment, you can track your chatbot using Google Analyticsย andย Meta Pixel. If you wish to track the chatbot 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 form 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 form 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>Was this article helpful?
Still need help?
Contact us