Javascript 访问以前存储的访问者级别自定义变量

Javascript 访问以前存储的访问者级别自定义变量,javascript,google-analytics,Javascript,Google Analytics,在Google Analytics中,访客级别的自定义变量存储在cookies中 我希望在GA自定义变量中存储一些数据,但前提是在此之前该插槽中未存储任何数据,即永远不要覆盖访客级别的自定义变量 有什么方法可以做到这一点,或者通过测试是否已经存储了一些数据,或者通过检索存储的值 没有\u getCustomVar,但是有没有什么方法可以让我自己做一些等效的事情,而不用“黑”到cookies中呢?有 例如: 它只适用于访问者级别的自定义变量,因为这是GA cookie中唯一存储的客户端大小。但我想

在Google Analytics中,访客级别的自定义变量存储在cookies中

我希望在GA自定义变量中存储一些数据,但前提是在此之前该插槽中未存储任何数据,即永远不要覆盖访客级别的自定义变量

有什么方法可以做到这一点,或者通过测试是否已经存储了一些数据,或者通过检索存储的值

没有
\u getCustomVar
,但是有没有什么方法可以让我自己做一些等效的事情,而不用“黑”到cookies中呢?

例如:

它只适用于访问者级别的自定义变量,因为这是GA cookie中唯一存储的客户端大小。但我想这正是你想要的

如果您想查看是否已经设置了非访问者级别的自定义变量,那么您需要自己编写逻辑,在设置自定义变量以便以后能够检索时存储一个单独的cookie。但这应该是一件简单的事情,而且可能比入侵专有cookies更好

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'xxxxxxxxxxxxxxx']);

   _gaq.push(function() {
        var pageTracker = _gat._getTrackerByName();
        var userTypeVar = pageTracker._getVisitorCustomVar(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>
例如:

它只适用于访问者级别的自定义变量,因为这是GA cookie中唯一存储的客户端大小。但我想这正是你想要的

如果您想查看是否已经设置了非访问者级别的自定义变量,那么您需要自己编写逻辑,在设置自定义变量以便以后能够检索时存储一个单独的cookie。但这应该是一件简单的事情,而且可能比入侵专有cookie更好。


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'xxxxxxxxxxxxxxx']);

   _gaq.push(function() {
        var pageTracker = _gat._getTrackerByName();
        var userTypeVar = pageTracker._getVisitorCustomVar(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>
var _gaq=_gaq | |[]; _gaq.push([''u setAccount',xxxxxxxxxxxxx']); _gaq.push(函数(){ var pageTracker=_gat._getTrackerByName(); var userTypeVar=pageTracker.\u getVisitorCustomVar(1); }); _gaq.push([''u trackPageview']); (功能(){ 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); })();

var _gaq=_gaq | |[];
_gaq.push([''u setAccount',xxxxxxxxxxxxx']);
_gaq.push(函数(){
var pageTracker=_gat._getTrackerByName();
var userTypeVar=pageTracker.\u getVisitorCustomVar(1);
});
_gaq.push([''u trackPageview']);
(功能(){
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);
})();

这正是我想要的,是的。奇怪的是,在自定义变量文档页面上没有提到它(而且谷歌快速搜索没有返回它)。这正是我想要的,是的。奇怪的是,自定义变量文档页面上没有提到它(而且谷歌快速搜索没有返回它)。