Google Analytics gives you the ability to capture additional information on a Hit, Session, User, or Product. This section will focus on capturing data on Users, but this same technique can be applied to Hits, Sessions, and Products just as easily.
This is the fifth article in a series. The series outlines how to use Google Analytics to answer questions you may have as a Guide manager 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
- Part 4 - Fine-tuning Help Center
- Part 5 - Capturing Help Center user data - YOU ARE HERE
If you haven't already done so, enable Google Analytics in your Help Center. See Enabling Google Analytics.
Capture a user's role in Google Analytics
For any logged-in user in Help Center, Zendesk can pass Google Analytics information on their role if they are logged in. A user in Help Center has one of the following roles:
- manager: This is a logged-in agent with admin privileges
- agent: This is a logged-in agent with standard privileges
- end_user: This is a logged-in end user
- anonymous: This is a user in Help Center that is not logged into Zendesk
To enable the capture of custom dimensions with a user's role
- Log in to Google Analytics and go to the Admin tab.
- Under the Property tab for your project, click Custom Definitions, then Custom Dimensions.
- Click New Custom Dimensions.
- Add a new dimension named "User Type" scoped to a User and make sure it is set to Active, then click Create.
- In Guide, go to edit the code for your theme (see Editing your Help Center theme).
- Open the script.js file in edit mode
- If your theme is using Templating API v2, paste the "Capture submit request event" code below in the DOMContentLoaded block:
document.addEventListener("DOMContentLoaded", function(){
//send user role to Google Analytics
var userRole = HelpCenter.user.role;
ga('set', 'dimension1', userRole);
ga('send', 'event', 'Help Center', 'Page view', {'nonInteraction': 1})
}); - If your theme is using Templating API v1, paste the "Capture submit request event" code below in the jQuery $(document).ready(function() { ... }); block:
$(document).ready(function() { //send user role to Google Analytics var userRole = HelpCenter.user.role; ga('set', 'dimension1', userRole); ga('send', 'event', 'Help Center', 'Page view', {'nonInteraction': 1}) });
Make sure the dimension numbers match the values for the custom variables you have in your Google Analytics account.

You should then have a report of Help Center pageviews by user role:
4 Comments
I would really appreciate any help with the above. I have tried a few things to no avail.
Is it possible to capture the user's organization (HelpCenter.user.organizations) in google analytics? I tried adding the following lines to the script but we are not capturing any valid data. Thanks!
Hi Stefano,
In regards to your concern, since Google Analytics is from our third-party provider there are some limitations with how can it be compatible with Zendesk's script.
Unfortunately, currently, it is not possible but we'll keep this article updated on some new development with the process.
John Espina | Customer Advocate
Thank you, @...!
Please sign in to leave a comment.