Skip to main content

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_interactions

Key variable

chat_Action

Chatflow

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_ActionDescription
widget openedChatbot opens
widget closedChatbot closes
conversation startedChat begins
message sentVisitor message
bot replyBot response
lead capturedLead form submitted
conversation endedSession 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

Related Listeners