Integrate HelpCrunch with Google Analytics

If you want to track chat/widget event in Google Analytics, just follow this guide.
Written by Konstantine
Updated 1 month ago

The mentioned functions work only with the gtag.js library.

You can easily track HelpCrunch chat/widget events with Google Analytics. For this, go to your website or application and insert the following tracking codes inside your HelpCrunch JavaScript code snippet.

For example, if your Google Analytics function is “gtag” (default one) you will need to add these codes after HelpCrunch (‘showChatWidget’);

Track when your customer sends a message in chat:

HelpCrunch('onCustomerMessage', function(ev) {
  gtag('event', 'sendChatMessage', {
    'event_category': 'customer',
    'action': 'sendChatMessage',
  });
});

Track when your customer initiates the chat:

HelpCrunch('onCustomerMessage', function (event) {
  if (event.detail.isFirstMessage) {
    gtag('event', 'sendFirstChatMessage', {
      'event_category': 'customer',
      'action': 'sendFirstChatMessage',
    });
  }
});

Track when your customer opens the chat:

HelpCrunch('onChatOpen', function(ev) {
  gtag('event', 'opensChat', {
    'event_category': 'customer',
    'action': 'opensChat',
  });
});

Track when your customer selects messenger integration in the chat

HelpCrunch('onClickByMessenger', function(ev) {
  gtag('event', 'Messenger' + ev.detail.name + 'Click', {
    'event_category': 'customer',
    'action': 'Messenger' + ev.detail.name + 'Click',
  });
});

Track when your customer closes the chat:

HelpCrunch('onChatClose', function(ev) {
  gtag('event', 'closesChat', {
    'event_category': 'customer',
    'action': 'closesChat',
  });
});

Track when your customer receives a new message:

HelpCrunch('onNewUnreadChat', function(ev) {
  gtag('event', 'getsNewMessage', {
    'event_category': 'customer',
    'action': 'getsNewMessage',
  });
});

Track when your customer submits the pre-chat form:

HelpCrunch('onPreChatFormSubmit', function(ev) {
  gtag('event', 'submitsPreChatForm', {
    'event_category': 'customer',
    'action': 'submitsPreChatForm',
  });
});

If you want to track any other event in Google Analytics – please get in touch with us in chat from your HelpCrunch admin account and we will arrange it for you.

Did this answer your question?