Zopim Chat - Track Chats as Conversions - Google Analytics 4 | The place for Zendesk users to come together and share
Skip to main content
Feedback submitted

Zopim Chat - Track Chats as Conversions - Google Analytics 4

Related products:Chat/Messaging
  • February 14, 2023
  • 6 replies
  • 8 views

Zopim Chat - Track Chats as Conversions - Google Analytics 4

To currently track zopim chats in the widget with Google Analytics 3 (GA3) we use your event called 'served by operator' which is sent with code from your zopim chat widget into GA3, when a chat is going on. However, GA3 is being made obsolete by Google in July 1 23. We rely quite heavily on tracking zopim chats with that 'served by operator' event in GA3 and were hoping it would be updated to work with Google Analytics 4 (GA4) by that time. I contacted support a year ago and didn't get a reply so replied back yesterday and was advised it is not supported.
It used to show a breakdown of chat agents. That's a good feature but not really needed.
What is needed essentially is the feature to send Google Analytics 4 an event when a chat is happening in the chat widget. All we want to do is track a chat as a lead. 

As an example, the recommended event generate lead could be sent when a chat is going.

https://support.google.com/analytics/answer/9267735?hl=en&ref_topic=9756175
https://developers.google.com/analytics/devguides/collection/ga4/reference/events?client_type=gtag#generate_lead

gtag("event", "generate_lead", {
  currency: "GBP",
  value: 01.00

We were hoping it might be added as a feature to be able to do this by the time it's made obsolete.

A few ways we could track chats as leads:

Obviously the most simple way is to update the event code to support GA4.

Alternatively there could be a new type of trigger that fires after x number of messages were sent by vistor. There could be a blank field to enter a GA4 event code in to, which want to run. That GA4 event code would then run when the trigger fires.

Another way could be to allow the operator chatting to the visitor in the chat widget, to redirect the visitor to the conversion success page on the website after the chat has completed, if that particular chat lead to an order.

-

There are other people asking as well on the comments here:

https://support.zendesk.com/hc/en-us/articles/4408889238810-Tracking-goals-and-conversions-with-Google-Analytics

6 replies

  • February 14, 2023

Great idea! We definitely need that.


  • Employee
  • February 15, 2023

Hi there Dan,

Thanks for sharing your feedback. The legacy Chat widget/Zopim widget is not being actively developed now and the team is focusing on the Web Widget/Messaging experience going forward.

In terms of alternative solutions, you can try and use the callback Javascript API for when a chat has started or ended to then execute the GA command to create a lead: https://developer.zendesk.com/api-reference/widget/chat-api/#on-chatstart 

Hope that helps unblock what you are hoping to achieve.

-Ramin

 


  • Author
  • February 16, 2023

Hi Ramin,

There's set on-chat start and isChatting. One fires when a chat started and the other checks if there is a chat session in progress. They seem quite similar. What's the difference?

Dan

 


  • Employee
  • February 16, 2023

Hi Dan

They may have some overlap depending on the use case. On Chat start is for the beginning of the chat session and isChatting is true when there is an ongoing chat session. 

For your use case, most customers use on Chat start to register when the visitor starts the chat request from the widget.

-Ramin


  • Author
  • March 11, 2023

Hi Ramin,

For the ischatting would this code look right to you? I've followed the instructions to initialize the sdk and wait for connection to be established before consuming api. It doesn't work. I'm assuming it doesnt work because for the google analytics4 gtag.js API to work the global site tag needs to be on the actual page that zopim in loading on. You have a html fragment as the widget (i think) but perhaps that loads on its own separate page that would need the gtag.js global site tag on. There's no way for us to put it our code on that page the widget loads i dont think?

<!--Start of Zendesk Chat Script-->
<script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");
$.src="https://v2.zopim.com/?4axxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";z.t=+new Date;$.
type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");

//start main zopim function
$zopim(function() {
	//start initialize sdk
	zChat.init({
		account_key: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
	});
	//end initialize sdk

	//Wait for connection to be established
	zChat.on('connection_update', function(status) {
		if (status === 'connected') {
			// Start consuming your API here

			// start check a chat is taking place
			if (zChat.isChatting()) {
				//record ga4 lead event, if it is
				gtag("event", "generate_lead", {
					currency: "GBP",
					value: 1
				});
				// end ga4 event code
			}
			else {
				// Nothing happening so do nothing
			}
			// end check a chat is taking place

		}
	});
	//End Wait for connection to be established
});
 //end main zopim function
</script><
!--End of Zendesk Chat Script-->

  • Employee
  • March 11, 2023

You are mixing the Web SDK APIs with the Zopim Widget which doesn't work, you need to use the Zopim Widget Javascript APIs after the widget and GA snippet has been initialised

Here are the developer docs for the Zopim widget Javascript APIs: https://api.zopim.com/files/meshim/widget/controllers/LiveChatAPI-js.html