0

我遇到了以下用于我的网站的 GA 代码,但我不太确定它在技术上是否正确。

我想要实现的是将 GA 信息发送到两个帐户xx-samplega-1xx-samplega-2

<script>
    var _gaq = _gaq || [];
     _gaq.push(['_setAccount', 'xx-samplega-1']);
     _gaq.push(['_trackPageview', '/ruby/appt_step1_page']);

     _gaq.push(['_setAccount', 'xx-samplega-2']);
     _gaq.push(['_trackPageview', '/ruby/appt_step1_page']);

    _gaq.push(['_addOrganic', 'search.maxonline.com.sg', 'search']);
    _gaq.push(['_addOrganic', 'fastbrowsersearch.com', 'q']);
    _gaq.push(['_addOrganic', 'search.babylon.com', 'search']);
    _gaq.push(['_addOrganic', 'search.maxonline.com.sg', 'q']);
    _gaq.push(['_addOrganic', 'search.conduit.com', 'q']);
    _gaq.push(['_addOrganic', 'search.esnips.com', 'searchQurey']);
    _gaq.push(['_addOrganic', 'search.freecause.com', 'p']);
    _gaq.push(['_addOrganic', 'search.goo.ne.jp', 'MT']);
    _gaq.push(['_addOrganic', 'search.hp.my.aol.sg', 'query']);
    _gaq.push(['_addOrganic', 'search.hiyo.com', 'q']);
    _gaq.push(['_addOrganic', 'search.iminent.com', 'q']);
    _gaq.push(['_addOrganic', 'search.mywebsearch.com', 'searchfor']);
    _gaq.push(['_addOrganic', 'search.sweetim.com', 'q']);
    _gaq.push(['_addOrganic', 'search.winamp.com', 'q']);
    _gaq.push(['_addOrganic', 'search-results.com', 'q']);
    _gaq.push(['_addOrganic', 'websearch.rakuten.co.jp', 'qt']);

     (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>
4

1 回答 1

1

您的分析代码有两个问题:

  1. 如果您想向多个帐户发送数据,您应该为其中一个帐户命名(t2在下面的代码中)
  2. _addOrganic命令应该在之前——_trackPageview您还必须为t2跟踪器复制它们。

就像是:

_gaq.push(['_setAccount', 'xx-samplega-1']);
_gaq.push(['_addOrganic', 'search.maxonline.com.sg', 'search']);
...
_gaq.push(['_addOrganic', 'websearch.rakuten.co.jp', 'qt']);
_gaq.push(['_trackPageview', '/ruby/appt_step1_page']);

_gaq.push(['t2._setAccount', 'xx-samplega-2']);
_gaq.push(['t2._addOrganic', 'search.maxonline.com.sg', 'search']);
...
_gaq.push(['t2._addOrganic', 'websearch.rakuten.co.jp', 'qt']);
_gaq.push(['t2._trackPageview', '/ruby/appt_step1_page']);
于 2013-07-09T13:48:31.827 回答