Text.com Chat GTM Event Listener
Track Text.com (formerly LiveChat) chat widget interactions in GTM. Capture customer_id, customer_email, chat_id, and 7 interaction types with text_action_type variable.
Event fired
text_chat_interactionsKey variable
text_action_typeText Chat (Text.com)
Overview
Text.com (formerly LiveChat, Inc.'s LiveChat product, now rebranded as Text) is a professional customer service platform. This listener captures extensive customer context, including customer_id, customer_email, customer_isReturning, session variables, and 7 interaction types, making it one of the richest chat listeners available.
Event fired: text_chat_interactions
Variables: text_action_type, customer_id, customer_email, customer_name, customer_isReturning, chat_id, thread_id
Why Use This Listener
The customer_isReturning flag lets you segment new vs. returning customer chat interactions. The session_variables capture enables you to pass CRM data into GA4 via the dataLayer.
Tracked Events
| text_action_type | Description |
|---|---|
chat_window_visibility_changed | Widget shown/hidden |
customer_status_updated | Visitor status change |
new_event | Message or file received |
form_submitted | Pre/post-chat form |
rating_submitted | Chat rated |
greeting_displayed | Greeting shown |
rich_message_button_clicked | Rich message CTA |
Installation
<!-- GTM Custom HTML Tag: Text.com Listener -->
<script>
(function() {
function textPush(actionType, extra) {
var api = window.LiveChatWidget || {};
var customerData = typeof api.get === 'function' ? api.get('customer_data') : {};
var chatData = typeof api.get === 'function' ? api.get('chat_data') : {};
window.dataLayer = window.dataLayer || [];
window.dataLayer.push(Object.assign({
'event': 'text_chat_interactions',
'text_action_type': actionType,
'customer_id': customerData && customerData.id,
'customer_name': customerData && customerData.name,
'customer_email': customerData && customerData.email,
'customer_isReturning': customerData && customerData.isReturning,
'customer_status': customerData && customerData.status,
'session_variables': customerData && customerData.sessionVariables,
'chat_id': chatData && chatData.chatId,
'thread_id': chatData && chatData.threadId
}, extra || {}));
}
window.LiveChatWidget.on('visibility_changed', function(data) {
textPush('chat_window_visibility_changed', { visibility: data.visibility });
});
window.LiveChatWidget.on('customer_status_changed', function(data) {
textPush('customer_status_updated', { customerStatus: data.status });
});
window.LiveChatWidget.on('new_event', function(data) {
textPush('new_event', { eventType: data.event && data.event.type });
});
window.LiveChatWidget.on('form_submitted', function(data) {
textPush('form_submitted', { form_type: data.type });
});
window.LiveChatWidget.on('rating_submitted', function(data) {
textPush('rating_submitted', { rating_value: data.value });
});
window.LiveChatWidget.on('greeting_displayed', function(data) {
textPush('greeting_displayed', { greeting_id: data.id, greeting_unique_id: data.uniqueId });
});
window.LiveChatWidget.on('rich_message_button_clicked', function(data) {
textPush('rich_message_button_clicked', {
event_id: data.eventId,
postback_id: data.postbackId
});
});
})();
</script>Data Layer Output
{
"event": "text_chat_interactions",
"text_action_type": "form_submitted",
"form_type": "pre-chat",
"customer_id": "cust_abc123",
"customer_email": "jane@example.com",
"customer_isReturning": true,
"chat_id": "chat_xyz789",
"thread_id": "thread_456"
}Trigger Configuration
Trigger Type: Custom Event
Event Name: text_chat_interactions
Variables to Capture
| Variable Name | DL Key | Example |
|---|---|---|
| DLV – Text Action Type | text_action_type | "form_submitted" |
| DLV – Text Customer ID | customer_id | "cust_abc123" |
| DLV – Text Customer Email | customer_email | "jane@example.com" |
| DLV – Text Is Returning | customer_isReturning | true |
| DLV – Text Chat ID | chat_id | "chat_xyz789" |
GA4 Mapping
| GA4 Event | Condition | Parameters |
|---|---|---|
chat_widget_open | visibility: maximized | customer_id, is_returning |
generate_lead | form_submitted (pre-chat) | customer_email, form_type |
chat_rating | rating_submitted | rating_value |
Best Practices
- Use
customer_isReturningas a GA4 dimension to compare new vs. returning user chat patterns - Use
session_variablesto pass UTM parameters from your site into the chat session customer_emailis available after form submission, gate it behind consent