Google Analytics and Help Center - Part 3: Tracking customers' actions Follow

team professional enterprise plans

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:

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 Help Center manager responsible for providing an effective self-service support option to your customers. The series covers the following topics:

If you haven't already done so, enable Google Analytics in your Help Center. See Enabling Google Analytics.

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

  1. In Help Center, navigate to the JavaScript code (General > Customize Design > Edit Theme > JS).
  2. Paste the "Capture submit request event" code below in the $(document).ready(function() { ... }); block:
    $(document).ready(function() {
    
      // stuff here
    
      // Capture submit request event
      $('a.submit-a-request, .article-more-questions a').on('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.

  3. Click Save and Publish changes.
  4. Verify that the event tracking is working. In 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?

Zendesk Support offers 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

  1. In Help Center, navigate to the JavaScript code (General > Customize Design > Edit Theme > JS).
  2. 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.

  3. Click Save and Publish changes.
  4. Verify that the event tracking is working. In 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

  1. In Help Center, navigate to the JavaScript code (General > Customize Design > Edit Theme > JS).
  2. 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. 

  3. Click Save and Publish changes.
  4. Verify that the event tracking is working. In 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

  1. In Help Center, navigate to the JavaScript code (General > Customize Design > Edit Theme > JS).
  2. 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.

  3. Click Save and Publish changes.
  4. Verify that the event tracking is working. In 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 Help Center?

Knowing the chronological order of actions by your customers in 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

  1. In Help Center, navigate to the JavaScript code (General > Customize Design > Edit Theme > JS).
  2. 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);
      });
    
    
  3. Click Save and Publish changes.
  4. Verify that the event tracking is working. In 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.

 

Have more questions? Submit a request

Comments

  • 0

    @Zendesk -,Product Team

    Reg,: Analytics/Tracking Click Results

    How to know how many Clicks done on each Help Center Questions/Articles on same page without creating separate URL for each questions?

    Edited by Nigam Parikh
  • 0

    @Nigam - if I'm understanding you correctly, you're asking if Google Analytics can analyze how many times someone clicked on each individual article, which is possible. You shouldn't need any extra set-up. Here's a screenshot of it in Google Analytics to show you where to look: http://screencast.com/t/DVtAWZVqX

  • 0

    Hello. Regarding 'Where do customers give up and submit a ticket?', is there a way I can find out in GA how often users actually submit a request? Currently, it seems that as soon as someone clicks on the 'Submit request' button, the action is recorded which makes it difficult to analyse how many people do actually submit a request of the ones who have (perhaps accidently) clicked on the 'Submit request' button.
    Thanks!

    Edited by Sandra Weigl
  • 0

    Hi Sandra! This is what I was able to come up with for tracking clicks of the 'Submit' button:

     // Track Submit button clicks
    
      $('#new_request footer input').on('click',function(e) {
        ga('send', {
      hitType: 'event',
      eventCategory: 'Submit Button',
      eventAction: 'Click',
      eventLabel: 'New Request'
      });
      });
    

    It isn't perfect - for example, it'll register an event even if the submission isn't successful - but hopefully it can get you started.

  • 0

    That's a good point, Sandra. The "Capture submit request event"/'Submit Request' would be better labeled "Capture initiate request event"/'Initiate Request'. Thanks for the code, Andrew.

  • 0

    Those examples (still) looks broken. I’m unable to get them to work unless I update and use them as suggested by Dom.

    // Download tracking
    $('.attachments a').on('click', function(e) {
        var $this = $(this),
        path = window.location.pathname;
        attachment = $this.text();
        ga('send', 'event', 'Download', path, attachment);
    });

    Notice the “ga(‘send’...” command. It shouldn’t be an array, as perhttps://developers.google.com/analytics/devguides/collection/analyticsjs/events

  • 0

    You are correct, the ga() function no longer takes an array. The syntax in the article has been updated.

    Reference: https://developers.google.com/analytics/devguides/collection/analyticsjs/events

  • 0

    Hi there, 

    I tried copying this code but the events aren't being captured. I really know nothing about javascript -- am I meant to replace any of the code with page-specific information?

    Thanks!

  • 0

    Hi Brittany!

    I see you're getting help with this issue in a ticket. Please feel free to come  back and share your solution when you've got everything sorted out!

  • 0

    The majority of the results I am seeing after having added the tracking of search events code are "(not set)." Even the search terms I am checking myself don't populate in the search events but I assume are being added as (not set). How can I make sure all the search terms are being captured?

  • 0

    Hi Emma - 

    Interesting question here! To better troubleshoot this I would likely need to take a look at your Help Center and ensure the scripts for Google Analytics have been configured correctly. I am going to pull this into a ticket and will reach out to you soon!

  • 0

    Is it possible to use the deflection tracking event to track when someone clicks on a suggested article, and also if they went on the submit a request in the same session?

    If one could record that someone was going to submit a ticket, but clicked on a suggestion, and then didn't, that could be taken a near-certain ticket deflection.

  • 0

    Hi Steve,

    When an end-user is deflected from the article suggestions, they are sent there within the same window. None of our provided GA methods track the overall session of a user, only click events, so creating a 'link' between two different events wouldn't be possible.

    In looking at Google's GA documentation, there's the potential for session cookie tracking which might accommodate what you're looking for:

    https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id

  • 0

    Hi there, i

    Is it possible to reference the Google Analytics Client Id to find out which HC he is?

  • 0

    Hi David,

    Thanks for your question!  I'm creating a support ticket with you, since exploring this may involve some questions about your account.  I'll be in touch soon!


    Thanks,

    Daniel | Customer Advocate - Tier 1 | support@zendesk.com

Please sign in to leave a comment.

Powered by Zendesk