1

这是我的代码:

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-xxxxxx-1', 'auto');

  ga('require', 'ecommerce');
  ga('ecommerce:addTransaction', {
    'id': '22287', // Transaction ID. Required.
    'affiliation': 'GBA', // store name.
    'revenue': '0.00', // total revenue.
    'shipping': '0.00', // Shipping.
    'tax': '0.0' // Tax.
   });

   ga('ecommerce:addItem', {
     'id': '22287', // Transaction ID. Required. Same as in the transaction data.
     'name': 'GBA', // Product name. Required.
     'sku': 'product123', // Product SKU.
     'category': '', // Product Category or variation.
     'price': '1.50', // Product price.
     'quantity': '1' // Product Quantity.
   });

   ga('ecommerce:send');
   ga('send', 'pageview');

这不跟踪电子商务中的任何内容,电子商务是从我的谷歌分析帐户启用的。

4

0 回答 0