Tracking Chef
  • Guides
    • Google Ads
    • Google Analytics
    • Google Tag Manager
    • Google Data Studio
    • Facebook
    • LinkedIn Ads
    • Hubspot
    • Segment
    • Quora Ads
    • Reddit Ads
  • Blog
  • GTM Playground
  • Swag
  • About
  • Guides
    • Google Ads
    • Google Analytics
    • Google Tag Manager
    • Google Data Studio
    • Facebook
    • LinkedIn Ads
    • Hubspot
    • Segment
    • Quora Ads
    • Reddit Ads
  • Blog
  • GTM Playground
  • Swag
  • About
Tracking Chef
  • Guides
    • Google Ads
    • Google Analytics
    • Google Tag Manager
    • Google Data Studio
    • Facebook
    • LinkedIn Ads
    • Hubspot
    • Segment
    • Quora Ads
    • Reddit Ads
  • Blog
  • GTM Playground
  • Swag
  • About
  • Guides
    • Google Ads
    • Google Analytics
    • Google Tag Manager
    • Google Data Studio
    • Facebook
    • LinkedIn Ads
    • Hubspot
    • Segment
    • Quora Ads
    • Reddit Ads
  • Blog
  • GTM Playground
  • Swag
  • About
Integrating the Zendesk Widget with GA4
Home » Google Analytics
January 9, 2023 Elad Levy

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.

image-1593026
Custom HTML tag with Zendesk event listener

Step 2: Create a new variable to capture the events

Create a new variable of the type Data Layer Variable named zendesk_action.

image-8853877

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.

image-6807136

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}}.

image-5716629

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.

image-7276005

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

image-4395507
The full GA4 Event for Zendesk

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.

About the Author

Elad Levy View all posts by Elad Levy

Experienced Web Analyst, working for almost a decade now with various web analytics tools.
Also a husband, father of three rascals, and the co-founder of Fixel.

« Previous
Next »
Leave a Reply

Click here to cancel reply.

Contents hide
Google Tag Manager (recommended)
Manual integration
Made with ❤️ by Elad Levy
Disclaimer: Some of the links shared on this site are affiliate links, so if you choose to make a purchase, I’ll earn a small commission. Please note, I only recommend tools I’ve used and have found useful, the commission is not a driving factor