Skip to main content

SnapEngage GTM Event Listener

Track SnapEngage chat interactions in GTM. Monitor open, close, messages, lead capture, and case creation with SnapEngage_eventAction variable.

snapengagechatgtmga4healthcareenterprisesupport

Event fired

snapEngageEvent

Key variable

SnapEngage_eventAction

SnapEngage

Overview

SnapEngage is an enterprise-grade live chat platform with HIPAA-compliant options, popular in healthcare and regulated industries. This listener hooks into SnapEngage's JavaScript callback system to track interactions.

Event fired: snapEngageEvent Variable: SnapEngage_eventAction

Tracked Events

SnapEngage_eventActionDescription
chat openedVisitor opens chat
chat closedWidget closed
chat startedConversation begins
message sentVisitor sends message
operator messageAgent sends message
lead capturedLead form submitted
case createdSupport case opened
chat offlineOffline contact submitted
proactive chat shownProactive invitation shown
proactive chat acceptedProactive invitation accepted
proactive chat declinedProactive invitation declined

Installation

html
<!-- GTM Custom HTML Tag: SnapEngage Listener -->
<script>
(function() {
  function snapPush(action, extra) {
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push(Object.assign({
      'event': 'snapEngageEvent',
      'SnapEngage_eventAction': action
    }, extra || {}));
  }

  var initSnap = function() {
    if (typeof window.SnapEngage === 'undefined') return;
    SnapEngage.setCallback('Open', function() { snapPush('chat opened'); });
    SnapEngage.setCallback('Close', function() { snapPush('chat closed'); });
    SnapEngage.setCallback('StartChat', function(email, msg, type) {
      snapPush('chat started', {
        chatVisitorEmail: email,
        chatVisitorType: type
      });
    });
    SnapEngage.setCallback('MessageSubmit', function(email, msg) {
      snapPush('message sent', { chatVisitorEmail: email });
    });
    SnapEngage.setCallback('ChatMessageReceived', function(agent, msg) {
      snapPush('operator message', { chatAgentName: agent });
    });
    SnapEngage.setCallback('Lead', function(email, msg) {
      snapPush('lead captured', { chatVisitorEmail: email });
    });
    SnapEngage.setCallback('ChatEnded', function() { snapPush('chat closed'); });
    SnapEngage.setCallback('ProactiveClose', function() { snapPush('proactive chat declined'); });
  };

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

Data Layer Output

json
{
  "event": "snapEngageEvent",
  "SnapEngage_eventAction": "lead captured",
  "chatVisitorEmail": "lead@example.com"
}

Trigger Configuration

Trigger Type: Custom Event Event Name: snapEngageEvent

Variables to Capture

Variable NameDL KeyExample
DLV – SnapEngage ActionSnapEngage_eventAction"chat started"
DLV – SnapEngage EmailchatVisitorEmail"user@example.com"

GA4 Mapping

GA4 EventConditionParameters
chat_widget_openchat openedchat_platform: "snapengage"
generate_leadlead capturedemail

HIPAA Note

SnapEngage can be configured for HIPAA compliance. If you handle PHI (Protected Health Information), do not push message content to the dataLayer, as this could expose PHI to your analytics tools.

Related Listeners