0

我有一个电子商务代码,其中我只传递交易 ID 和数量详细信息。但这并没有记录在 GA API 中。下面是代码。

<script type="text/javascript" language="javascript">
var _gaq = _gaq || [];
_gaq.push(
['mainind._setAccount', 'UA-12345-1'],
['mainind._setDomainName', '.abcd.com'],
['mainind._setAllowHash', false],
['mainind._trackPageview'],
['mainind._trackPageLoadTime']
);

_gaq.push(['_addTrans',
    '136069322',    
    '',                 
    '',                 
    '',                 
    '',                 
    '',                 
    '',                 
    ''                  
]);
_gaq.push(['_addItem',
    '136069322',                        
    '',                                     
    '',                                     
    '',                                     
    '',                                     
    '4' 
]);

_gaq.push(['_trackTrans']); 

(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();

这个你能帮我吗..

谢谢,阿肖克维尔玛

4

1 回答 1

1

您必须为通过 _setAccount ('mainind') 定义的同一跟踪器对象调用 _addTrans、_addItem 和 _trackTrans 命令:

  <script type="text/javascript" language="javascript">
var _gaq = _gaq || [];
_gaq.push(
['mainind._setAccount', 'UA-12345-1'],
['mainind._setDomainName', '.abcd.com'],
['mainind._setAllowHash', false],
['mainind._trackPageview'],
['mainind._trackPageLoadTime']
);

_gaq.push(['mainind._addTrans',
    '136069322',    
    '',                 
    '',                 
    '',                 
    '',                 
    '',                 
    '',                 
    ''                  
]);
_gaq.push(['mainind._addItem',
    '136069322',                        
    '',                                     
    '',                                     
    '',                                     
    '',                                     
    '4' 
]);

_gaq.push(['mainind._trackTrans']); 

(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();

另请注意,_setAllowHash_trackPageLoadTime已弃用,应将其删除。

于 2013-05-07T11:34:40.363 回答