If you’re already using Zendesk to power chat on your site, you probably already have it integrated into your Google Analytics account to report on events. Just like other popular tools, Zendesk hasn’t yet released a native GA4 integration for their product.
In this guide, I’ll walk through two methods of integrating Zendesk with GA4.
Important note: In both scenarios you will also need to create a matching Custom Dimension in Google Analytics to be able to report on the specific actions taken in Zendesk
Google Tag Manager (recommended)
Adding the GA4 event using GTM (Google Tag Manager) is simple.
Step 1: Add Custom HTML Listener Tag
In your GTM containers, create a new Custom HTML tag and name it “Zendesk Listener”.
Paste in the tag the following snippet:
<script>
if (window.zE) {
zE('webWidget:on', 'userEvent', function(event) {
dataLayer.push({
'event':'zendesk_event',
'zendesk_action': event.action
});
});
}
</script>
Add a trigger to fire the tag on all pages and save the tag.

Step 2: Create a new variable to capture the events
Create a new variable of the type Data Layer Variable named zendesk_action.

Step 3: Create a new trigger
Create a new trigger of the type Custom Event. The event’s name should be set to zendesk_event.

Step 4: Add a GA4 event tag
Next, create a new GA4 Event tag and associate it with the relevant GA4 Configuration Tag.
Set the Event Name to {{Event}}.

Add a new event parameter called zendesk_action. Pair the parameter with the variable created as its value.
You can of course alter the zendesk_action to use any parameter name of your choice.

Finally, add the trigger you created to the event tag and you’re all set.

Manual integration
If you’re not using GTM on your site, you can simply add this snippet to track any Zendesk event on your site.
This script checks for the presence of the zE method, indicating that the Zendesk widget is active, in conjunction with the GTAG snippet present. Only if both exist, it will trigger the relevant events to GA4.
if (window.zE && window.gtag) {
zE('webWidget:on', 'userEvent', function(event) {
gtag('event', 'zendesk_event',{
'zendesk_action': event.action
});
});
}
Be sure to create a Custom Dimension in Google Analytics so that the zendesk_action will be available in reports.
You can of course alter the zendesk_action to use any parameter name of your choice.
Leave a Reply