Skip to main content

Drift Chat GTM Event Listener

Track 18 Drift chat interactions in Google Tag Manager including meeting bookings, email captures, playbook firings, and GDPR clicks. Complete dataLayer reference.

driftchatsalesgtmga4conversational-marketingmeetings

Event fired

driftchat_action

Drift Chat

Overview

Drift is a conversational marketing and sales platform. This listener is one of the most comprehensive chat listeners available, capturing 18 distinct interactions including meeting bookings, email captures, playbook firings, campaign interactions, GDPR consent clicks, and phone number provision.

Event fired: driftchat_action Primary variable: chatAction (interaction description)

Why Use This Listener

Drift is often the critical conversion point in a B2B buying journey. Meeting bookings and email captures from Drift are high-intent signals that should be tracked as primary conversions, not just engagement events.

Common Use Cases

  • Track Drift meeting bookings as pipeline conversions in GA4 and Google Ads
  • Fire Meta Lead events on email capture
  • Build audiences of users who engaged with Drift playbooks
  • Track GDPR consent as a compliance event
  • Measure bot campaign effectiveness by tracking playbook firings
  • Correlate chat engagement with downstream revenue

Tracked Events (18 Total)

EventchatAction Value
Conversation starteduser started conversation
Campaign openeduser opened campaign
Campaign clickeduser clicked campaign
Campaign dismisseduser dismissed campaign
Campaign submitteduser submitted campaign
Widget openedchat widget opened
Widget closedchat widget closed
Playbook firedplaybook fired
Playbook clickedplaybook clicked
Playbook dismissedplaybook dismissed
Meeting requestedmeeting request initiated
Meeting bookedmeeting booked
Phone providedphone number provided
First interactionfirst interaction in conversation
Welcome openedwelcome message opened
Welcome closedwelcome message closed
Button clickedbutton clicked in chat
Email capturedemail captured
GDPR clickedgdpr clicked

Installation

html
<!-- GTM Custom HTML Tag: Drift Chat Listener -->
<script>
(function() {
  var driftEvents = [
    ['startConversation', 'user started conversation'],
    ['campaign:open', 'user opened campaign'],
    ['campaign:click', 'user clicked campaign'],
    ['campaign:dismiss', 'user dismissed campaign'],
    ['campaign:submit', 'user submitted campaign'],
    ['sidebarOpen', 'chat widget opened'],
    ['sidebarClose', 'chat widget closed'],
    ['conversation:playbookFired', 'playbook fired'],
    ['conversation:playbookClicked', 'playbook clicked'],
    ['conversation:playbookDismissed', 'playbook dismissed'],
    ['scheduling:requestMeeting', 'meeting request initiated'],
    ['scheduling:meetingBooked', 'meeting booked'],
    ['phoneCapture:phoneNumberProvided', 'phone number provided'],
    ['conversation:firstInteraction', 'first interaction in conversation'],
    ['welcomeMessage:open', 'welcome message opened'],
    ['welcomeMessage:close', 'welcome message closed'],
    ['conversation:buttonClicked', 'button clicked in chat'],
    ['emailCapture:emailCaptured', 'email captured'],
    ['gdpr:clicked', 'gdpr clicked']
  ];
  
  function driftReady() {
    driftEvents.forEach(function(eventDef) {
      drift.on(eventDef[0], function(data) {
        var push = {
          'event': 'driftchat_action',
          'chatAction': eventDef[1],
          'chatWidgetID': drift.config && drift.config.appId,
          'chatSessionID': data && data.sessionId
        };
        
        if (data) {
          if (data.conversationId) push.chatConversationID = data.conversationId;
          if (data.playbookId) push.chatPlaybookID = data.playbookId;
          if (data.campaignId) push.chatCampaignID = data.campaignId;
          if (data.email) push.chatVisitorEmail = data.email;
          if (data.teamMemberId) push.chatTeamMemberID = data.teamMemberId;
          if (data.buttonText) push.chatButtonText = data.buttonText;
          if (eventDef[0] === 'scheduling:meetingBooked') {
            push.chatMeetingTime = data.meetingTime;
            push.chatMeetingDuration = data.duration;
            push.chatMeetingTimeZone = data.timeZone;
            push.chatTeamMemberName = data.teamMemberName;
          }
        }
        
        window.dataLayer = window.dataLayer || [];
        window.dataLayer.push(push);
      });
    });
  }
  
  if (window.drift) {
    drift.on('ready', driftReady);
  } else {
    window.addEventListener('load', function() {
      if (window.drift) drift.on('ready', driftReady);
    });
  }
})();
</script>

Data Layer Output

Meeting Booked (High-Value Conversion)

json
{
  "event": "driftchat_action",
  "chatAction": "meeting booked",
  "chatWidgetID": "abc123",
  "chatSessionID": "session_xyz",
  "chatConversationID": "conv_456",
  "chatTeamMemberID": "agent_789",
  "chatTeamMemberName": "Sarah Johnson",
  "chatMeetingTime": "2024-02-15T14:00:00Z",
  "chatMeetingDuration": 30,
  "chatMeetingTimeZone": "America/New_York"
}

Email Captured

json
{
  "event": "driftchat_action",
  "chatAction": "email captured",
  "chatVisitorEmail": "prospect@company.com",
  "chatWidgetID": "abc123"
}

Trigger Strategy

PriorityActionTriggerTags
🔴 HighMeeting BookedchatAction = "meeting booked"GA4 conversion, Google Ads, Meta Lead
🟠 MediumEmail CapturedchatAction = "email captured"GA4 generate_lead
🟡 MediumConversation StartedchatAction = "user started conversation"GA4 engagement
🟢 LowWidget OpenedchatAction = "chat widget opened"GA4 engagement

Variables to Capture

Variable NameDL KeyExample
DLV – Drift ActionchatAction"meeting booked"
DLV – Drift Widget IDchatWidgetID"abc123"
DLV – Drift Session IDchatSessionID"session_xyz"
DLV – Drift EmailchatVisitorEmail"user@company.com"
DLV – Drift Playbook IDchatPlaybookID"playbook_123"
DLV – Drift Meeting TimechatMeetingTime"2024-02-15T14:00"

GA4 Mapping

GA4 EventTriggerParameters
book_appointmentmeeting bookedchat_platform, team_member, meeting_time
generate_leademail capturedchat_platform, email
chat_widget_openwidget openedchat_platform

Debugging

ProblemCauseFix
drift is not definedDrift not loadedUse Window Loaded trigger + check
Events not firingDrift API version mismatchCheck Drift's event name documentation
Meeting booked not trackingDrift scheduling not enabledEnable Drift Meetings in settings

Best Practices

  1. Prioritize meeting bookings, this is the primary B2B conversion signal from Drift
  2. Gate email captured events by consent status before pushing to GA4
  3. Use Drift's visitor API to enrich pushes with company/email data when available
  4. A/B test playbooks, use chatPlaybookID to compare playbook performance in GA4

Related Listeners