This post is also available in: Russian
In this post, we will continue to discuss not so widely known but still pretty useful features of Google Analytics, and apply them to real cases. We believe that visitor segmentation might be effective for almost all Web sites. Normally, every business has more than one target group of customers. So it is very interesting to group your prospects (visitors) to get an idea how to convert them. The more groups you have, the higher is the probability to develop a successful strategy to add prospects to your customer base.
In our case, we’ll make an simple, but a real life case study. We have a corporate website and a blog. The company’s employees constantly develop the site – making improvements, adding features and spending too much time on it. So the objective is to sort out site visits and usage of such visitors.
At the first sight, this could be done with Google Analytics filters. But in our case, they are all but applicable: the company’s employees have dynamic IP addresses, some of them access the site from their homes and via the mobile networks. In such cases, you can apply Google Analytics user segmentation tools. To solve the problem, let’s create a new user segment consisting of the employees of the company, and then sort out their data in the Google Analytics administration interface.
First, select a page available to the employees only. For this purpose, you can create an internal zone requiring sign-in or use your administration interface. Then, before the page tracking code, add a JavaScript method call
1 | _setCustomVar (index, name, value, opt_scope) |
to set a user variable.
This function accepts 4 parameters:
- index — a slot for the variable, ranging from 1 to 5. So you have up to 5 variables for each event / visit. If you need more, then probably you should buy commercial off-the-shelf systems like Omniture.
- name — the name of the variable shown in the Google Analytics reports.
- value — the value of the variable; typically, several possible values are used for a variable.
- opt_scope — the scope of the variable, numeric: 1 (user level), 2 (session level) and 3 (page view level). Default value is 3 (page view).
Finally, you should get something like this:
1 2 3 | var pageTracker = _gat._getTracker("UA-XXXXXXXX-X"); <strong>pageTracker._setCustomVar(1,"Visitor_Type","Employee",1 );</strong> pageTracker._trackPageview(); |
It is worth noting that the
1 | _setCustomVar |
method was introduced quite recently to replace the old
1 | _setVar |
method. The values set with
1 | _setCustomVar |
appeared in statistics more than a day later, while the
1 | _setVar |
assignments emerged in several hours. In any case, you’d better use the new method, as the old might be phased out anytime.
Finally, we have to tune the Google Analytics admin interface. Let’s go. First, make sure that the segmentation data is received by Google Analytics. Check the report “Visitors” -> “Custom variables”. It should contain the custom variables as follows:
Если Вы использовали метод
1 | _setVar |
то нужно смотреть другой отчет: “Пользователи” -> “Определено пользователем” и выглядит он приблизительно так:
Now you can segment most reports and analyze data in the context of the company employees and outside visitors. To obtain the segmented data, in the upper right corner select “Advanced Segments” and then click “Create a new advanced segment”. In the segment designer indicate that the Custom variable (value 1 – slot) should not contain “Employee”, to sort out the company’s employees. After this, test the segment, to make sure there are no errors in the settings.
After this, choose this segment in the report and enjoy the segmentation. You will see something like this:
To avoid configuring segmentation every time, set the filter for employee visits. We recommend you to create a separate profile for the filter, as after applying the filter you will not be able to view the source data.
Now you can generate ideas on how to use this tool for more advanced segmentation in order to know more of your visitors. You can use this approach to track behavior of different groups of users: unknown visitors, current customers, people communicating in your blog, users subscribed to your mail list, etc.
We would be happy if you share your opinion on the article and your unique experience with the features discussed.