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, edit the code for your theme.
- Open the script.js file in edit mode.
- Paste the "Capture submit request event" code below in the
$(document).ready(function() { ... });
block if you’re using Templating API v1 or thedocument.addEventListener('DOMContentLoaded', function() {
block if you’re using Templating API v2: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 if you’re using Templating API v1 or thedocument.addEventListener('DOMContentLoaded', function() {
block if you’re using Templating API v2:// Capture ticket deflection event var requestForm = document.querySelector("#new_request") if (requestForm) { requestForm.addEventListener('click', function(e) { if (e.target.matches('.searchbox-suggestions a')) { ga('send', 'event', 'Ticket Deflection', 'Deflect', e.target.href); } }); }
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, edit the code for your theme.
- Open the script.js file in edit mode.
- Paste the "Community Ticket Deflection event" code below in the
$(document).ready(function() { ... });
block if you’re using Templating API v1 or thedocument.addEventListener('DOMContentLoaded', function() {
block if you’re using Templating API v2:Array.prototype.forEach.call(document.querySelectorAll('.new_community_post'), function(el) { el.addEventListener('click', function(e) { if (e.target.matches('.searchbox-suggestions a')) { ga('send', 'event', 'Community Ticket Deflection', 'Deflect', e.target.href); } }) });
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, edit the code for your theme.
- Open the script.js file in edit mode.
- Paste the "Social sharing tracking" code below in the
$(document).ready(function() { ... });
block if you’re using Templating API v1 or thedocument.addEventListener('DOMContentLoaded', function() {
block if you’re using Templating API v2:Array.prototype.forEach.call(document.querySelectorAll('.share a'), function(el) { el.addEventListener('click', function(e) { var shareType = e.currentTarget.className.replace('share-', ''); var path = window.location.pathname; ga('send','event','Social Share', shareType, path); }) });
The type parameter captures the social medium that is clicked, (examples, Facebook, 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, edit the code for your theme.
- Open the script.js file in edit mode.
- Paste the "Capture search submit event" code below in the
$(document).ready(function() { ... });
block if you’re using Templating API v1 or thedocument.addEventListener('DOMContentLoaded', function() {
block if you’re using Templating API v2:Array.prototype.forEach.call(document.querySelectorAll('form[role="search"]'), function(el) { el.addEventListener('submit', function(e) { query = e.currentTarget.querySelector('input[type="search"]').value.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.
11 Comments
Has anyone actually gotten tracking instant search clicks to work? If your SEO is good enough, people would be clicking on the instant search results instead of hitting enter to see search results. Missing out on that data is huge, especially if it makes up 30% of your user's searches.
I have yet to see any sort of solution posted from Zendesk on this, and people have been bringing this up for at least a year.
Hi Christopher,
Thanks for your question!
As mentioned in the yellow note in our other article, we're not currently capturing click-throughs for instant search in our native reporting. However, I've been in touch with our product team and would like to let you know that adding instant search to the new reporting is definitely on our radar, but not for the first release. We expect to include instant search numbers over the course of the next year.
In the meantime, you can use Google Analytics to track clicks on instant search, but this will require some customisation on your end to do such a deeper analysis. This type of customisation is not currently supported by our team.
Hope it helps!
How would one go about tracking form submissions with GA4?
Using Google Tag Manager, I'm trying to set up a tag to capture form submissions, but it requires the class, element, or label of the submit button. I'm unable to find these for the form submit button.
document_head.hbs
theme template file, according to the Google Analytics documentation.We are not also finding in our documentation about class, element, or label but you may follow our guide on how to use Google Tag Manager in your Help Center here: Using Google Tag Manager with your help center.
Thank you!
Hi all, we are starting to roll out GA4 support for Help Center.
See the announcement here.
Hi Gorka Cardona-Lauridsen
Replying here to your comment in the Enabling GA article--seems to make more sense since it is about the snippets on this page.
We're currently using the submit ticket and deflection snippets. Your reply on the other article indicated the snippets would not be impacted by GA4 but "neither will it give you the same event" (and you provided a link to the auto collected events and custom event creation).
This makes it seem like something (a custom event?) needs to be done in GA4 for the reporting to still function in GA4 for the snippets in this article. But this article doesn't mention any changes. Can you clarify?
Lila Kingsley,
You are absolutely right that this article should give guidance on how to achieve the same with GA4. We are working on an update. I'll post a comment when we have updated the article.
Gorka Cardona-Lauridsen it would be great to have guidance for GA4. I can see, that part of metrics/events are created automatically, but there are few (i.e. tracking of pages with requests initiated) that's need to be created manually.
Gorka Cardona-Lauridsen We are also interested in how to go about implementing the "Where do customers give up and submit a ticket?" code for GA4. Looking forward to that update, thank you!
Thank you for your feedback and insights! We appreciate it!
+1 to Josh and Jakub's comments
Please sign in to leave a comment.