Google Analytics gives you the ability to track events so that you can monitor just about anything your customers do in your help center, including submitting tickets, clicking ticket deflection links, and sharing content. Events tell you how users interact with your content and are tracked independently of page loads. You enable event tracking by attaching a JavaScript snippet to the particular UI element you want to track. All user activity on such elements is calculated and displayed as events in the Behavior > Events section of the Google Analytics dashboard.
The article covers the following topics:
- Where do customers give up and submit a ticket?
- Which articles and posts are effectively deflecting?
- Are customers sharing the articles on social networks?
- What path do customers take in your help center?
To learn more about the code used in this article to track events in Google Analytics, see Event Tracking in the Google docs.
This is the third article in a series. The series outlines how to use Google Analytics to answer questions you may have as a Guide admin responsible for providing an effective self-service support option to your customers. The series covers the following topics:
- Part 1 - Asking the right questions
- Part 2 - Measuring the effectiveness of search
- Part 3 - Tracking customers' actions - YOU ARE HERE
- Part 4 - Fine-tuning your help center
- Part 5 - Capturing help center user data
If you haven't already done so, enable Google Analytics in your help center. See Enabling Google Analytics. Also, some of the examples in this article include JQuery code. If you are using Guide templating V2, you'll need to import a jQuery library if you want to use jQuery statements in a theme. See About Guide templating versions and Importing or ugrading JQuery.
Where do customers give up and submit a ticket?
You can learn where in your help center customers give up and decide to submit a ticket. Most pages in a help center have a “Submit a request” link that lets customers submit a ticket using a Web form.
You can use Google Analytics to capture the URL of the page the customer is on when they decide enough is enough, they want to talk to an agent. Understanding what page a customer is on when they decide to jump ship is valuable for identifying areas of improvement in your design or content.
To enable tracking of pages where requests are initiated
- In Guide, go to edit the code for your theme, see Editing your help center theme.
- Open the script.js file in edit mode.
- Paste the "Capture submit request event" code below in the $(document).ready(function()
{ ... });
block:
Array.prototype.forEach.call(document.querySelectorAll('a.submit-a-request, .article-more-questions a'), function(submitRequestButton) { submitRequestButton.addEventListener('click', function(e) { var path = window.location.pathname; ga('send', 'event', 'Submit Request', 'Submit Request From', path); }); });
An event is recorded each time a customer clicks the “Submit a request” link. The path parameter captures the URL of the page that the customer was on when they clicked the button.
- Click Save, then click Publish changes.
- Verify that the event tracking is working. In the help center, click a couple "Submit a request" links. In the Google Analytics dashboard, go to Standard Reports > Real-Time > Events and check to make sure the events are captured.
Wait a few days to gather some data. Now take a look at the article pages where customers are deciding to submit tickets. Are there any surprises? Is there a page where you can tell customers are looking for an answer, not finding one, and thereby submitting a request? Look for ways to fix the problem so they don't have to resort to submitting a request.
Which articles and posts are effectively deflecting?
There is a built-in ticket deflection feature that automatically suggests related articles from your help center when a customer attempts to submit a ticket. The suggested articles are based on the content entered in the subject line of the request. If your customers see an article that might answer their question, they can simply click the link and go to the article. Hurray for one less ticket!
When a customer attempts to create a new community post, you can also offer suggestions for related community posts in your help center. The suggested posts are based on the content entered in the title of the new post.
To measure how well your articles and posts are doing at deflecting tickets and community questions, you can track the events.
To enable tracking of deflected ticket events for articles
- In Guide, go to edit the code for your theme, see Editing your help center theme.
- Open the script.js file in edit mode.
- Paste the "Capture ticket deflection event" code below in the
$(document).ready(function() { ... }); block:
$(document).ready(function() { // Capture ticket deflection event $("#new_request").on('click', '.searchbox-suggestions a', function(e) { var $this = $(this), link = $this.attr('href'); ga('send', 'event', 'Ticket Deflection', 'Deflect', link); });
An event is recorded each time a customer clicks an article suggestion. The tracking code also captures what articles are selected from the list of suggested articles.
- Click Save, then click Publish changes.
- Verify that the event tracking is working. In your help center, click a couple article suggestions on the Submit a Ticket page. In the Google Analytics dashboard, go to Standard Reports > Real-Time > Events and check to make sure the events are captured.
Use what you learn to identify the articles that are selected most often by customers wanting to submit a support request. It may be useful to promote the articles in your help center to draw more attention to them.
To enable tracking of deflected community post events
- In Guide, go to edit the code for your theme, see Editing your help center theme.
- Open the script.js file in edit mode.
- Paste the "Community Ticket Deflection event" code below in the
$(document).ready(function() { ... });
block:
$(".new_community_post").on('click', '.searchbox-suggestions a', function(e) { var $this = $(this), link = $this.attr('href'); ga('send', 'event', 'Community Ticket Deflection', 'Deflect', link); });
An event is recorded each time a customer clicks a post suggestion. The tracking code also captures which posts are selected from the list of suggested posts.
- Click Save, then click Publish changes.
- Verify that the event tracking is working. In your help center, click a couple post suggestions on the New Post page. In the Google Analytics dashboard, go to Standard Reports > Real-Time > Events and check to make sure the events are captured.
Are customers sharing the articles on social networks?
You can capture if and how your customers share your articles on social networks. Specifically, you can track each time a customer clicks a social sharing link in an article:
Aside from better understanding your customers' preferred social media channels, the metric helps you understand the virality of the articles in your help center.
The sharing component, {{share}}, must be present in the Article template of your help center theme. The component is not present by default in the Curious Wind and The Noble Feast themes. If you don’t have the {{share}} component or if you removed it, you can add it to your Article template. See Customizing the HTML.
To start tracking events in Google Analytics, you need to add some JavaScript (JS), code to your help center pages. The JS listens for a specific customer interaction such as a click. When it detects the interaction, it sends information about the event to Google Analytics.
To enable tracking of social sharing events
- In Guide, go to edit the code for your theme, see Editing your help center theme.
- Open the script.js file in edit mode.
- Paste the "Social sharing tracking" code below in the $(document).ready(function() { ...
}); block:
$(document).ready(function() { // stuff here // Social sharing tracking $('.share a').on('click', function(e) { var $this = $(this), type = $this.attr('class').replace('share-',''), path = window.location.pathname; ga('send','event','Social Share',type, path); }); // maybe more stuff here });
The type parameter captures the social medium that is clicked, (e.g. Facebook, Twitter, LinkedIn, or Google Plus). The path parameter captures the URL of the article that the user is sharing.
- Click Save, then click Publish changes.
- Verify that the event tracking is working. In your help center, click a couple sharing links. In the Google Analytics dashboard, go to Standard Reports > Real-Time > Events and check to make sure the events are captured.
What path do customers take in your help center?
Knowing the chronological order of actions by your customers in your help center can reveal their self-service behavior and habits. You can use Google Analytics to track this flow of events.
Before going any further, let's set up tracking of another common event that we haven't covered yet: searches.
To enable tracking of search events
- In Guide, go to edit the code for your theme, see Editing your help center theme.
- Open the script.js file in edit mode.
- Paste the "Capture search submit event" code below in the $(document).ready(function() {
... }); block:
$(document).ready(function() { // stuff here // Capture search submit event $('form[role="search"]').on('submit', function(e) { var $this = $(this), query = $this.find('input[type="search"]').val().toLowerCase(); ga('send', 'event', 'Search', 'Submit', query); });
- Click Save, then click Publish changes.
- Verify that the event tracking is working. In your help center, perform a couple of searches. In the Google Analytics dashboard, go to Standard Reports > Real-Time > Events and check to make sure the events are captured.
Now it’s time to string together all the events you're tracking to get a chronological view of your customers' actions. If you added and tested all of the events in this article, you should have four different event categories in your Google Analytics event reports. To recap, an event is recorded each time a user:
- shares an article on a social media network
- clicks the “Submit a request” button to create a ticket
- abandons submitting a ticket in favor of a suggested article
- searches on your help center
To determine the most common order of events
- In the Google Analytics dashboard, navigate to Behavior > Events > Event Flow.
The Event Flow report shows you the order in which users perform events in your help center. Click any of the categories in the first Event column to see the second, third, and fourth events that users performed afterwards. For example, you can see how many users searched your help center, then clicked “Submit a ticket”, then deflected to a suggested article they couldn’t find before.
That's all the event tracking we're going to cover. If you track other events that you find useful, please share them with us in the comments below.
53 Comments
Hi Andrei,
Apologies for the wait. That code snippet is current and functional. I think we should take a look at your code together over a ticket. I'll see you there.
Hi Andrei,
I'm seeing that the account
aword.zendesk.com
is no longer active. Is there another Zendesk account you're using this code on? The code snippet is correct so we should look at the implementation together.Thank you,
Brian Green | Tier 3, Technical Support Architect | support@zendesk.com
Hello there,
Seems like only chats are registering as first events in my events workflow. I have enabled the ticket deflection code snippet and it has tracked 3 unique events (and so I know it has actually it works), but it seems to not register as a first time event. How can I fix this?
(Please see screenshot)
Thanks,
Melody W
Hi Brian.
I have submitted a ticket for you. :)
Hi guys.
Our helpcenter is in Russian so when i see links in Events it looks like /hc/ru/articles/115002104525-%D0%9A%D0%B0%D0%BA-%D0%BD%D0%B0%. How can I decode all these %D0%9A%D0%B0% into cyrillic symbols?
For anyone who is tracking ticket deflection through the auto-suggested articles in the chat widget:
Does anyone have an average of what percent of tickets are deflected through the auto-suggested articles?
I've learned, with the recent GDPR in Europe, the visits and actions on ZD Guide are not reliable - using Google Analytics (because Europeans can opt out of being tracked while on your site). We noticed this recently with a decline of views and posts on Community. We painfully checked it natively and it was indeed inaccurate.
Can you please confirm that this is the case? Right now we're relegated to the very light community analytics on Zendesk reports.
For those ZD reports:
Can someone shed some light on this?
Hi - is there any way to track an individuals engagement with Guide articles? I am investigating whether we can report on the total number of articles a given user has accessed over a period of time. Is there a way of incorporating the Zendesk user id so that Google Analytics can provide this type of data?
Is this possible? Thanks!
Hi Raymond. I don't know if there is a way to track an individual path but there is a way to track different kind of users. All you need is to tag your users as described here: https://support.zendesk.com/hc/en-us/community/posts/203460006 Users must be logged in, otherwise you won't be able to see their tags in GA.
If you have few users, perhaps, you could give every of them an individual tag or something.
Btw, Zendesk has Pathfinder for Enterprise (and it's available as add-on for Professional plan), this one allows you to see the path of your users before they reached out your support team.
I was going to suggest Pathfinder also!
Pathfinder is great, but I got the email this week that it will not function after October 14. It sounds like similar functionality will be added to the interaction history using Sunshine but a date was not provided.
You could take a look at the Sunshine Event APIs to generate the event data yourself. Adding code into your help center article templates could allow you to write views to the user's event log and capture these.
Hi There,
Do you have any feedback or case about modification of the events tracking code you provide to make dataLayer pushes instead of sending data to GA directly?
This way it could work perfectly with GTM: https://support.zendesk.com/hc/en-us/articles/115010634068-Using-Google-Tag-Manager-with-your-Help-Center
Thanks
Hi,
Sorry if it's not in the correct thread or article but, at the beginning of the article, it is mentioned :
There is a built-in ticket deflection feature that automatically suggests related articles from your Help Center when a customer attempts to submit a ticket.
I wasn't able to find an explanation on how to implement that. Is there an article about this configuration, please?
Thank you very much in advance!
Hello Clotilde,
This functionality is built into the Zendesk Guide product. When a customer fills in the subject line of a ticket, it works like a search field to auto-suggest potential articles in your help center that may resolve the issue they are about to submit. This works out of the box without any configuration other than adding articles into the Help Center and retaining the subject field on your ticket form.
Hi,
Hoping someone can help me with the issue below.
I'm trying to track the search events on a search box with instant search. I tried the suggestions on this comment https://support.zendesk.com/hc/en-us/articles/203664156/comments/360000209187
However:
Is there another workaround I can do to track the search?
Hey Karlina,
Have you gone through this article for measuring the effectiveness of search? It may also be worth taking a look at Googles documentation for setting up site search tracking which I've linked for you.
Hopefully others can jump in here and offer up some additional guidance for you as well :)
Cheers!
Hi,
I am having the same issue that Andrei Kamarouski was 1 year ago - I've attempted to implement the tracking of pages where requests are initiated, but I am not seeing any Events registered in Google Analytics (despite seeing the real-time traffic when I am on the site).
The code was valid 1 year ago, but is it valid today? I'm using the pre-built Copenhagen theme for example, and see no instance of
in the script.js file. Only
document.addEventListener('DOMContentLoaded', function() {
has there been an update to the snippet required to track clicks on that Submit a request link?
I'm having the same issue as Kate above. I'm using the Copenhagen theme and I'm unable to find the instance of:
Can you please assist? Thanks!
Hi Kate and Joey,
You can replace the following jQuery opening:
with the JavaScript equivalent:
Thank you, Charles -- this worked!
Hi Charles,
Thank you for the response - just want to make sure I'm following correctly as I'm not seeing any Events triggered on our GA still. Apologies if I'm being dense, but do you mean the code should be set up as follows? I have had it like this since I began working on this issue but still see no events registered, despite triggering them myself for a test.
Thanks,
Kate
It turns out the Google Analytics code uses jQuery extensively (anything with a $ is jQuery) and needs to be rewritten for Copenhagen v2 using standard JavaScript. The simplest solution would be to import the jQuery library in your v2 theme. Here's an article that explains how:
https://support.zendesk.com/hc/en-us/articles/360037983854-Importing-or-upgrading-jQuery
Hope this helps.
Hi there,


I have imported jQuery and added the code block to capture submitted request events. Unfortunately, it doesn't work for me, GA doesn't show events.
Is there something I'm doing wrong?
Please sign in to leave a comment.