I'm trying to set a custom variable in my Google Analytics tracking for a very rough form of split testing.
The code I'm using at the end of my 'head' section is
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', 'UA-xxxxxx-xx'],
['_setCustomVar', 1, 'split', '1', 2],
['_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);
开发者_如何学运维})();
The page view is tracking fine but I'm not seeing anything other than "(not set)" under the User-defined sub-section of the Visitors section.
Can anyone spot anything wrong? I've had this working before using the older ga.js before the Asynchronous stuff came along.
Thanks.
_setCustomVar data shows up in the Visitors "Custom Variables" report. Only data from _setVar shows up in the "User Defined" report.
精彩评论