In Part I of this series we spoke about session level variables. In Part II we discussed page level variables. Now we are going to talk about Visitor Level variables. This variety of variable is the highest of the three levels; the tag assigned is permanent and remains disassociated during following visits until the visitor deletes the cookie or overwrites it’s value.
Visitor-level custom variables are used to differentiate the type of visitors who access your site across multiple sessions, such as a member, account holder, visitor or guest. You can make use of this variable to evaluate which users are paying members, what type of membership they have (if you have multiple levels), and visitors who are only guests. This custom variable would be set as a one-time function, given that the value would be carried across the life of the visitor cookie.
Visitor Level Variables follow these coding guidelines:
_setCustomVar(index, name, value, opt_scope)
The coding set up would look like this:
_gaq.push([‘_setCustomVar’,
1, // This custom var is set to slot #1. Required parameter.
‘Member Rate’, // The name of the custom variable. Required parameter.
’12 Months’, // The value of the custom variable. Required parameter.
// (possible values might be Free, 3 Months, 6 Months, and 12 Months)
1 // Sets the scope to visitor-level. Optional parameter.
]);
The finished coding would look like this:
<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXX-1’]);
_gaq.push([‘_setCustomVar’,1,’Member Rate’,’12 Months’, 1]);
_gaq.push([‘_trackPageview’]);
(function() { var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true; ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’; var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s); })();
</script>
Now that you have set your variables and are tracking them, it is time to see the results. You can find your reports in Visitors > Demographic > Custom Variables report.
The report will display your variables as a “KEY”. There are 5 keys available with 5 values attached to each key.
During our three part series on As Easy as 1, 2, 3: Custom Variables, we have learned how to define additional segments to apply to visitors, about coding parameters, where and how to use each variable and how the different levels; Session (Used to distinguish different visitor experiences across sessions), Page (Used to define a collection of page-level activities by your users) and Visitor (Used to distinguish categories of visitors across multiple sessions) are unique.
We had a look at the reports and the type of information you can choose to add to your data flow. With custom variables, you can label additional segments to apply to your visitors in addition to what is already provided by Google Analytics.