Recent searches
No recent searches
Help Center user segmentation using Google Analytics custom dimensions
Posted Sep 04, 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 comments
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
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
George Panoschi
Hi, could anyone help me make a segment from a website that is not structured with " / " ?
0
bill cicchetti
Resurrecting this article.
So I am trying to create a custom dimension in GA for user role.
1) I have GA activated and see out of box reports and dashboards populated.
2) I added this to the script.js file
//send user role to Google Analytics
var userRole = HelpCenter.user.role;
ga('set', 'dimension1', userRole);
ga('send', 'pageview');
});
I went into Chrome DEV Tools and saw no errors.
3) I logged into GA and create a custom dimension
If this all looks correct how to I add a criteria to a custom report to filter on end users?
Do I need a specific value for dimension and filter?
0
Christopher Stock
Hi @..., you're almost there. The final piece of the puzzle is to create a custom segment that uses the values recorded by your custom dimension.
You'll see an 'Add Segment' box at the top of most of the GA reporting pages:
Click on this, then on 'New Segment':
Then select 'Conditions', under the 'Advanced' heading on the side-panel:
From there you'll need to search for your custom dimension in the first conditional select menu (mine is called User Role, yours would be userRole):
Change the operator from 'contains' to 'exactly matches', and then select the value you want to segment (i.e. end_user, anonymous, agent etc.).
That should be all there is to it.
0
Evan Walker
Hey there!
I'm trying to get this to work, and I just can't seem to capture the user roles in Google Analytics, when I search it keeps coming up with nothing. I've added a custom segment like the previous comment advised, and when I try to search it still comes up with nothing.
This is the code I've added to the Help Center:
0
Catherine Michalak
Hi there,
Could anyone advise what would be the best way to set up this type of segmentation using user tags?
User role is good, but user locale isn't useful in our case. Tags however capture various user attributes like country, department etc that I'd love to be able to dissect the data by.
For example when we see that users search for "bike scheme" with zero search results but do not know from which location, it's difficult for us to make useful changes to content, to address the issue. Being able to break this down by user tag country would be very helpful.
Thanks
Catherine
0
Ryan McGrew
Hey @...,
Tags are available in JavaScript via the following attribute
This is an array of the tags on the user, so it needs to be handled a little differently. Let's say you had dimension1 set to userCountry or something like that. You could then iterate over the set of tags and try to map tags to the dimensions you'd like to set. It might look something like this:
0
Catherine Michalak
Hi Ryan,
Thanks for this.
I'm quite new to the coding world and so have some basic questions.
Which of the values in the above code would i need to replace? Do I need to list out all existing country tags?
Our user profiles depending on location would have one of these tags for example (country:netherlands, country:united_kingdom, country:spain, etc). We have users in over a 100 countries.
Thanks
Catherine
0
Ryan McGrew
Good questions. So since you have tags set up with country: as the prefix, it'll probably make this a bit easier. Here's how I think this could work in your case:
This would send a value of country:united_kingdom or country:spain as the value of dimension1. This assumes the country name after country: is just letters, numbers and _ characters. I don't know exactly how your tags are structured, so I can't say it'll 100% work. But this should get your started.
0
Kaley Beck
Is there a way to view data/filter data by user organization?
0
Elaine
Yes, you can filter data in Google Analytics by user organization information that you've set up in Zendesk. To achieve this, you typically need to:
0