向Google Analytics发送自定义名称 var _gaq=_gaq | |[]; _gaq.push(['''u setAccount','UA-xxxxxxx-x']); _gaq.push([''设置客户变量(1,'固定线路','账户摘要]); _gaq.push([“跟踪事件”,“电话媒体”,“账单指南]); (功能(){ 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); })();

向Google Analytics发送自定义名称 var _gaq=_gaq | |[]; _gaq.push(['''u setAccount','UA-xxxxxxx-x']); _gaq.push([''设置客户变量(1,'固定线路','账户摘要]); _gaq.push([“跟踪事件”,“电话媒体”,“账单指南]); (功能(){ 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); })();,javascript,google-analytics,Javascript,Google Analytics,设置自定义变量的语法不正确。您试图直接调用不存在的名为setCustomVar的全局函数 应该是: <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-xxxxxxx-x']); _gaq.push(['_setCustomVar(1,'landline','acct_Summary']); _gaq.push(['_trackEvent','Te

设置自定义变量的语法不正确。您试图直接调用不存在的名为setCustomVar的全局函数

应该是:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxx-x']);
  _gaq.push(['_setCustomVar(1,'landline','acct_Summary']);

  _gaq.push(['_trackEvent','Telemedia','bill_guide']);

  (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
实际上,您并不是在这里调用_setCustomVar函数;因为这是异步代码,所以您只是命名将被调用的函数及其接收的参数。当GA代码执行时,它将调用该数组第一个参数中列出的函数,后面的参数中定义了参数


值得注意的是,在当前的配置中,由于您没有设置最终的
范围
参数,它默认为页面级别。也就是说,它将只跟踪该页面的该变量,因此不会持续。如果您想将其更改为会话级别,请将该值设置为2;对于访问者级别,请将其设置为1。

设置自定义变量不正确。您试图直接调用不存在的名为setCustomVar的全局函数

应该是:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxx-x']);
  _gaq.push(['_setCustomVar(1,'landline','acct_Summary']);

  _gaq.push(['_trackEvent','Telemedia','bill_guide']);

  (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
实际上,您并不是在这里调用_setCustomVar函数;因为这是异步代码,所以您只是命名将被调用的函数及其接收的参数。当GA代码执行时,它将调用该数组第一个参数中列出的函数,后面的参数中定义了参数

值得注意的是,在当前配置中,由于您没有设置最终的
范围
参数,它默认为页面级别。也就是说,它将仅跟踪该页面的该变量,因此不会持续。如果要将其更改为会话级别,请将该值设置为2;对于访客级别,请将其设置为1