0

我正在尝试为慈善网站上的捐款设置电子商务跟踪。我已将代码放在适当的位置,交易正在通过,但我缺少 SKU、类别、价格和数量等详细信息。

这是 GA 电子商务的屏幕截图。您可以看到缺少的数据。

这是 GA 电子商务的屏幕截图。

这是感谢页面的 HTML 输出。

var _gaq = _gaq || [];
    var pluginUrl =
      '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
    _gaq.push(['_require', 'inpage_linkid', pluginUrl]); // enhanced link attribution
    _gaq.push(['_setAccount',  'UA-xxxxxxxx-1']); // your GA ID
    _gaq.push(['_setDomainName', 'xxxx.xx']); // track sub domains
    _gaq.push(['_setAllowLinker', true]);
    _gaq.push(['_addIgnoredRef', 'xxxx.xx']); // prevent self referrals
    _gaq.push(['_trackPageview']); // track the page view
    _gaq.push(['_addTrans',
      '525e5cdb1ffd6751ef00000d',           // transaction ID - required
      'xxxx xxxxxx',          // affiliation or store name
      '25',            // total - required
      '', // city
      '', // state or province
      '' // country
    ]);
    _gaq.push(['_addItem',
       '525e5cdb1ffd6751ef00000d', // transaction ID
       'Child sponsorship', // SKU/code – required
       '', // donation type - Ignored
       'Donation', // category or variation
       '25', // unit price – required
       '1' // quantity – required
    ]);
    _gaq.push(['_trackTrans']); // submits transaction to the analytics server
    (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);
    })();

任何可能导致问题的想法以及如何解决问题都会很棒。

提前致谢。

4

1 回答 1

1

According to https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce?hl=sk#_gat.GA_Tracker_._addItem

Supply a value for the name parameter at all times. While the name parameter is not required, items added to a transaction without a name parameter do not appear in the product breakdown for a transaction. While you will still see the total revenue for the transaction, you will not be able to see how much revenue a particular item contributed to the transaction total.

Since you don't provide item name in _addItem, maybe this is the problem. On your screenshot there's Revenue but no products.

于 2013-10-16T11:28:39.250 回答