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 interactionKey variable
chatActionPure 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
| chatAction | Description |
|---|---|
operator available | Agent comes online |
operator unavailable | Agent goes offline |
chat widget opened | Visitor opens chat |
chat widget closed | Visitor closes chat |
message sent | Visitor sends message |
message received | Operator replies |
chat ended | Session 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 Name | DL Key | Example |
|---|---|---|
| DLV – Pure Chat Action | chatAction | "message sent" |
| DLV – Pure Chat ID | chatId | "chat_abc123" |