Help Center user segmentation using Google Analytics custom dimensions
Publicado 04 sept 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 comentarios
Jessie Schutz
Hi Corrin! Thanks for coming back and sharing what you found out from Support. I'm going to follow up on this Tip to see if we can get it updated.
0
Corrin Duque
I received an update from Zendesk that this article references an old legacy code. The following articles were provided to help modify using the new code Google supports:
https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs
https://developers.google.com/analytics/devguides/collection/analyticsjs/
0
Corrin Duque
I also need the correct code for the exact example in this article as using the one given broke our java script.
I have a Zendesk ticket out on this as I had to remove the script due to the unwanted impact of the presence of the script causing the Submit button on the customer's request page to disappear.
We truly need to be able to measure user role in our Google Analytics so would be grateful for the functional script! Thanks!
0
OT
I want to use the exact example in this article, ie tracking based on user role. Does anyone have a corrected script for this that doesn't break everything?
Thanks!
0
Tony Roma
Hi Sandra,
Just getting back to metrics after focusing on my main responsibility as Insightly's product writer for a bit. (The Many Hats situation of life at a start-up!) Our custom dimension is available in the Site Content reports and others. And our pageview counts have normalized, so this worked for us.
I hope you worked it out.
0
Tony Roma
Hi Sandra,
I guess we're on the right track. :) Ours is a User-level metric, so I believe it will be applicable across reports through segmentation. Once we've updated our code and answer a couple more questions, I'll update this comment to let you know what happens for us.
Thanks for sharing your experience, too!
0
Sandra Weigl
Hi Tony,
I just got the same reply in the Google Analytics user forum :) I updated the code in my post above as well.
I changed the code in JS but I can no longer report on the custom dimensions in Behavior > Site Content. Instead, I can then add the CDs to the statistics in Behavior > Events.
Is this how it is supposed to be? Does this mean I can't really combine the statistics before and after changing the custom dimensions to event hits?
Thanks,
Sandra
0
Tony Roma
Hi Sandra,
I've run into the same problem. I took a class from a very helpful Google Analytics consultancy called LunaMetrics which helped me catch this. They've also proposed a solution:
If the custom dimension is set at the Session or User level, then you can use an Event instead of a pageview. What the event Category/Action/Label say isn't really important, as we're just using it as a vehicle to get the data into Google Analytics. The important part is the "non-interaction parameter" - which tells Google not to count this as an interaction, which means it won't influence Bounce Rate or Time on Site.
https://developers.google.com/analytics/devguides/collection/analyticsjs/events
ga('set', 'dimension1', tag);
ga('send', 'event', 'ZenDesk', 'UserType', tag, {
nonInteraction: true,
});
I'll update my suggestion above to include this parameter.
0
Sandra Weigl
Hello, I am using several custom dimensions (added in the JS code). I have one ga 'send' function below the custom dimensions to get the data into Google Analytics. However, since a page hit is already created by default, I get duplicate pageview hits.
Any suggestions on what I could do to avoid the duplicate pageview hits?
0
Tony Roma
Updated to reflect a better workflow and avoid using ga('send', 'pageview');
We're trying to segment actions based on user tags for paid customers, staff, other (logged in, other tags), and anonymous (not logged in).
GA dimension is set to a User-level scope. We'll also pass this through with a non-interaction event, so we don't double our pageviews.
// Google Analytics user tag dimension
var tag="";
if (HelpCenter && HelpCenter.user.tags) {
var staff_user = (HelpCenter.user.tags.indexOf("staff") > -1);
var paid_user = (HelpCenter.user.tags.indexOf("paid") > -1);
if (staff_user === true) {
tag = "staff";
}
else if (paid_user === true) {
tag = "paid";
} else {
tag = "other";
}
} else {
tag = "anonymous"
}
ga('set', 'dimension1', tag);
ga('send', 'event', 'ZenDesk', 'UserType', tag, {
nonInteraction: true,
});
0
Iniciar sesión para dejar un comentario.