HelpScout Beacon GTM Event Listener
Track HelpScout Beacon chat and knowledge base interactions in GTM. Monitor open/close, messages, search queries, article views, and email captures with chatBeaconId and chatAction.
helpscoutbeaconchatknowledge-basegtmga4supportsaas
Event fired
Helpscout_InteractionKey variable
chatBeaconIdHelpScout (Beacon)
Overview
HelpScout's Beacon widget combines live chat, a help center knowledge base, and a contact form. This listener hooks into Beacon's JavaScript API to track opens, closes, message sends, article views, knowledge base searches, and email captures.
Event fired: Helpscout_Interaction
Variables: chatBeaconId, chatAction
Common Use Cases
- Track support deflection (article views vs. messages)
- Measure knowledge base search effectiveness
- Build GA4 segments of users who needed support
- Fire lead events on email capture
Tracked Events
| chatAction | Description |
|---|---|
beacon opened | Beacon widget opens |
beacon closed | Beacon closes |
message sent | User sends chat message |
email captured | Email submitted via Beacon |
article viewed | Knowledge base article opened |
search performed | User searched the help center |
suggest shown | Article suggestions displayed |
suggest article clicked | Suggestion article clicked |
Installation
html
<!-- GTM Custom HTML Tag: HelpScout Beacon Listener -->
<script>
(function() {
function beaconPush(action, extra) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push(Object.assign({
'event': 'Helpscout_Interaction',
'chatAction': action,
'chatBeaconId': window.Beacon ? '' : '' // Beacon ID from init
}, extra || {}));
}
var initBeacon = function() {
if (typeof window.Beacon === 'undefined') return;
Beacon('on', 'open', function() { beaconPush('beacon opened'); });
Beacon('on', 'close', function() { beaconPush('beacon closed'); });
Beacon('on', 'email-submitted', function(data) {
beaconPush('email captured', { visitorEmail: data.email });
});
Beacon('on', 'message', function() { beaconPush('message sent'); });
Beacon('on', 'article-viewed', function(data) {
beaconPush('article viewed', {
articleId: data.id,
articleTitle: data.text
});
});
Beacon('on', 'search', function(data) {
beaconPush('search performed', { searchQuery: data.query });
});
Beacon('on', 'suggest', function() { beaconPush('suggest shown'); });
Beacon('on', 'suggest-article-clicked', function(data) {
beaconPush('suggest article clicked', { articleId: data.id });
});
};
window.addEventListener('load', initBeacon);
})();
</script>Data Layer Output
Article Viewed
json
{
"event": "Helpscout_Interaction",
"chatAction": "article viewed",
"articleId": "article_123",
"articleTitle": "How to reset your password"
}Search Performed
json
{
"event": "Helpscout_Interaction",
"chatAction": "search performed",
"searchQuery": "billing issue"
}Trigger Configuration
Trigger: Custom Event | Helpscout_Interaction
Per action:
Condition: DLV – HC Action | equals | message sent
Variables to Capture
| Variable Name | DL Key | Example |
|---|---|---|
| DLV – HS Action | chatAction | "message sent" |
| DLV – HS Article ID | articleId | "article_123" |
| DLV – HS Search Query | searchQuery | "billing issue" |
GA4 Mapping
| GA4 Event | Condition | Parameters |
|---|---|---|
chat_widget_open | beacon opened | chat_platform: "helpscout" |
search | search performed | search_term |
view_item | article viewed | item_name (article title) |
Best Practices
- Track
search performedvs.message sentratio, high search rate with low message rate means your docs are working - Use
articleIdto identify which knowledge base articles prevent support tickets - Track
email capturedfor lead generation from Beacon contact forms