Chatflow GTM Event Listener
Track Chatflow chatbot interactions in GTM. Monitor widget open, messages, and lead captures with chat_Action variable.
chatflowchatbotchatgtmga4lead-generation
Event fired
chatflow_interactionsKey variable
chat_ActionChatflow
Overview
Chatflow is a chatbot platform for lead generation and customer engagement. This listener tracks widget and conversation interactions.
Event fired: chatflow_interactions
Variable: chat_Action
Tracked Events
| chat_Action | Description |
|---|---|
widget opened | Chatbot opens |
widget closed | Chatbot closes |
conversation started | Chat begins |
message sent | Visitor message |
bot reply | Bot response |
lead captured | Lead form submitted |
conversation ended | Session ends |
Installation
html
<!-- GTM Custom HTML Tag: Chatflow Listener -->
<script>
(function() {
function cfPush(action, extra) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push(Object.assign({
'event': 'chatflow_interactions',
'chat_Action': action
}, extra || {}));
}
var initCF = function() {
if (typeof window.Chatflow === 'undefined') return;
Chatflow.on('open', function() { cfPush('widget opened'); });
Chatflow.on('close', function() { cfPush('widget closed'); });
Chatflow.on('conversationStart', function() { cfPush('conversation started'); });
Chatflow.on('messageSent', function() { cfPush('message sent'); });
Chatflow.on('botReply', function() { cfPush('bot reply'); });
Chatflow.on('leadCapture', function(data) {
cfPush('lead captured', { leadEmail: data.email });
});
Chatflow.on('conversationEnd', function() { cfPush('conversation ended'); });
};
window.addEventListener('load', initCF);
})();
</script>Data Layer Output
json
{
"event": "chatflow_interactions",
"chat_Action": "lead captured",
"leadEmail": "prospect@company.com"
}Trigger Configuration
Trigger Type: Custom Event
Event Name: chatflow_interactions