Skip to main content

Pure Chat GTM Event Listener

Track Pure Chat interactions in Google Tag Manager. Monitor chat widget open/close, messages, and operator availability with chatAction and chatId variables.

pure-chatchatgtmga4supportsmall-business

Event fired

pure chat interaction

Key variable

chatAction

Pure Chat

Overview

Pure Chat is a live chat tool for small and medium businesses. This listener hooks into Pure Chat's JavaScript callback system to track widget interactions.

Event fired: pure chat interaction Variables: chatAction, chatId

Tracked Events

chatActionDescription
operator availableAgent comes online
operator unavailableAgent goes offline
chat widget openedVisitor opens chat
chat widget closedVisitor closes chat
message sentVisitor sends message
message receivedOperator replies
chat endedSession ends

Installation

html
<!-- GTM Custom HTML Tag: Pure Chat Listener -->
<script>
(function() {
  function purePush(action, extra) {
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push(Object.assign({
      'event': 'pure chat interaction',
      'chatAction': action
    }, extra || {}));
  }

  var initPure = function() {
    if (typeof window.PureChat === 'undefined') return;

    PureChat.on('availability_changed', function(data) {
      purePush(data.available ? 'operator available' : 'operator unavailable');
    });
    PureChat.on('chat_started', function(data) {
      purePush('chat widget opened', { chatId: data.chatId });
    });
    PureChat.on('chat_closed', function(data) {
      purePush('chat widget closed', { chatId: data.chatId });
    });
    PureChat.on('message_sent', function(data) {
      purePush('message sent', { chatId: data.chatId });
    });
    PureChat.on('message_received', function(data) {
      purePush('message received', { chatId: data.chatId });
    });
    PureChat.on('chat_ended', function(data) {
      purePush('chat ended', { chatId: data.chatId });
    });
  };

  window.addEventListener('load', initPure);
})();
</script>

Data Layer Output

json
{
  "event": "pure chat interaction",
  "chatAction": "chat widget opened",
  "chatId": "chat_abc123"
}

Trigger Configuration

Trigger Type: Custom Event Event Name: pure chat interaction

Variables to Capture

Variable NameDL KeyExample
DLV – Pure Chat ActionchatAction"message sent"
DLV – Pure Chat IDchatId"chat_abc123"

Related Listeners