Help Center user segmentation using Google Analytics custom dimensions
Data ultimo post: 04 set 2014
Many customers ask how they can segment out their Help Center activity metrics based on user role. While this isn’t currently possible using the Help Center dashboards, it is quite easy to do using the Zendesk Google Analytics integration and custom dimensions.
Step 1: Enable Google Analytics Site Search Tracking on your Help Center
If you haven’t enabled Site Search Tracking for Google Analytics, follow the steps in this article to enable it on your Help Center.
Step 2: Configure custom dimensions
Google Analytics Custom Dimensions are a way to capture custom information on a user when they visit your Help Center or anywhere where you have Google Analytics tracking enabled.
First of all you must configure your Custom Dimensions in Google Analytics properly. This must be configured in the Analytics User Interface.
Go to the Admin section of Google Analytics and then to Custom Definitions > Custom Dimensions. Create two new Custom Dimensions. Custom Dimensions have the following configuration values:
- Name – the name of the custom dimension as it will appear in your reports.
- Scope – specifies to which data the custom dimension or metric will be applied. Learn more about Scope.
- Active – whether the custom dimension or metric value will be processed. Inactive custom dimensions may still appear in reporting, but their values will not be processed.
You should create a custom dimensions named User Role and User Locale that have a Session scope and are active.
The first custom dimension is called User Role and tracks the Role of the user using the HelpCenter.user.role value (eg. manager, end_user, anonymous, etc) in Slot 1.
The second custom dimension is called User Locale and the tracks the locale of a user using the HelpCenter.user.locale value (en-US, en-UK, etc) in Slot 2.
These will allow me to segment all of the activity and search metrics by these two custom dimensions.
Step 3: Set a custom dimensions for visitors
Once the custom dimensions are defined you can see which dimension they are assigned to ( dimension[0-9]+) and you can use in code. In my example account they are dimension1 and dimension2. You can then use this dimension in the code
- name—The name for the custom dimension. Required. This is a string that identifies the custom dimension and appears in your reports. (dimension[0-9]+)
- value—The value for the custom dimension. Required. This is a string that is paired with a name. You can pair a number of values with a custom dimension name. The value appears in the table list of the UI for a selected variable name. Typically, you will have two or more values for a given name. For example, you might define a custom variable name gender and supply male and female as two possible values.
In this example, I have included two Help Center custom dimensions on the Session level. These must sent along as part of a custom event. It is important that we define this as a non-interaction event so that it does not contribute to bounce rates or other important metrics. This will eventually look something like this when it's all put together:
ga('send', 'event', 'Help Center', 'User', {
'dimension1': HelpCenter.user.role,
'dimension2': HelpCenter.user.locale,
nonInteraction: true
});
Step 3: Look at your Google Analytics metrics sliced by custom dimensions
It may take an hour or so for the new custom dimensions to be available in your Google Analytics project. Once the custom dimensions have synced with your Google Analytics project, you can segment your metrics by the custom dimensions.
In this example, I have broken out page views by User Locale by navigating to Reporting > Behavior > Site Content > All Pages and selecting Secondary Dimension > Custom Dimension > User Role.
0
42 commenti
Ryan McGrew
I just realized the below comment won't work. Please disregard
***
I also just realized that we also have the user object in the template that you could use as well to assign a variable in JavaScript.
***
Thanks!
0
Ryan McGrew
Hey Dan!
This identifier is actually a 1 way sha1 hash of the user id so you can't decrypt it. However, you could potentially user the email address in the user object for this. That should be a unique identifier for the user.
You can also use the API endpoint /api/v2/users/me.json to get the current user information, including id.
Thanks!
0
Dan McDade
It looks like the reason that HelpCenter.user.id does not work is because it is not available in the javascript object.
https://gist.github.com/skipjac/8186753
I can see that the HelpCenter.user.identifier is available but this seems like it might be some sort of a hashed id value. Is there any documentation anywhere that I can refer to to understand how this value is hashed to decrypt this value into my user ids?
0
Dan McDade
I wanted to include user.id in what I am sending to google analytics, but for some reason it does not seem to be working. I went through the steps listed and created 3 dimensions, the user.role, user.locale, and user.id. I can see the user.role and user.locale being populated but user.id is not. Any reason this might be?
Thanks!
0
Ryan McGrew
Hey Peter,
That will depend on your user roles and your account plan level. If you have created custom roles on Enterprise, any role with the Help Center Manager role will be reported as "manager".
You can see more here: https://support.zendesk.com/hc/en-us/articles/203662026-Creating-custom-roles-and-assigning-agents-Enterprise-
But based on the predefined Enterprise roles, you would have:
End user is anyone that has a log in but is not an agent or manager. Anonymous is anyone browsing your Help Center while not logged in. I hope this helps.
Thanks!
0
Peter Rush
Hi Ryan - thanks for the quick response. Can you provide a table showing how the standard user roles in the interface map to the JSON values in session?
Like this...
Administrator >> Manager
Agent >> Agent
etc
0
Ryan McGrew
Hey @Peter,
You're correct that this is a bit of legacy of the Zendesk product evolving over time. Many times when we update user facing labels in code, the internal representation in the database and other systems doesn't necessarily get the same update to avoid any unforeseen consequences. Additionally a few other roles can have admin privileges like Team Leader or a user with the Help Center Manager permission.
There are 4 possible values in the context of HelpCenter.user.role
Let me know if that answers your question.
0
Peter Rush
A question about user role - I was expecting to see the role value correspond exactly to the "Role" user field in the app. However, it appears that users with "Administrator" role in the app don't have HelpCenter.user.role = "Administrator". It's "Manager".
Can anyone confirm the ZenDesk logic here for how actual user roles in the app map to HelpCenter.user.role in JSON?
Thanks!
0
Jennifer Rowe
That's great news! Thanks for reporting back, Corrin!
0
Corrin Duque
I believe my question was answered by the results! Even though the article does state "It may take an hour or so for the new custom dimensions to be available in your Google Analytics project" I expected to see them a bit sooner.
In logging out and back in several records suddenly populated.
So entering only the JS code indicated in step 3 worked great. I suppose the Google Analytics example is for other platforms.
Thank you again for updating!
0
Accedi per aggiungere un commento.