2014-03-01 102 views
4

該代碼在下面提供。我將它包含在感謝頁面中。谷歌分析電子商務跟蹤不起作用

##ITEM# - these are the replace codes and they are working just fine. 

什麼問題?

<!-- GOOGLE ANALYTICS ECOMMERCE CONVERSION TRACKING --> 
<!-- https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce --> 

<script> 

ga('require', 'ecommerce', 'ecommerce.js'); 

ga('ecommerce:addTransaction', { 
    'id': ##ORDER_ID#,      // Transaction ID. Required. 
    'revenue': ##ORDER_PRICE#,    // Grand Total. 
    'tax': ##ORDER_PRICE_TAX#      // Tax. 
}); 

ga('ecommerce:send'); 

</script> 
<!-- END: GOOGLE ANALYTICS CONVERSION TRACKING --> 
+1

你包括的analytics.js也? - 我認爲沒有這些,交易追蹤不會奏效。 –

+0

是否在檢查標準報告之前等待24小時? – DaImTo

+0

@DaImTo是我做過 – chuckfinley

回答

4

我已經集成ecommnerce代碼在我的項目,它是對我工作的罰款。下面我添加了代碼。

<script> 
(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','//www.google-analytics.com/analytics.js','ga'); 

ga('create', 'UA-XXXX-Y', 'auto'); 
ga('send', 'pageview'); 
ga('require', 'ecommerce', 'ecommerce.js'); // Load the ecommerce plug-in. 

ga('ecommerce:addTransaction', { 
    'id': '1234',      // Transaction ID. Required 
    'affiliation': 'Acme Clothing', // Affiliation or store name 
    'revenue': '11.99',    // Grand Total 
    'shipping': '5',     // Shipping 
    'tax': '1.29'      // Tax 
}); 

// addItem should be called for every item in the shopping cart. 
ga('ecommerce:addItem', { 
    'id': '1234',      // Transaction ID. Required 
    'name': 'T-Shirt',    // Product name. Required 
    'sku': 'DD44',  // SKU/code 
    'category': 'Green Medium',  // Category or variation 
    'price': '11.99',     // Unit price 
    'quantity': '1'     // Quantity 
}); 

</script> 

請通過給出的鏈接瞭解詳情:ecommerce tracking code

編碼快樂.. :-)

+4

你忘記了ga('ecommerce:send'); – Dan

1

,必須先激活GA - 電子商務選項。

GA: 管理 - >電子商務設置 - >啓用電子商務 - >狀態:ON

相關問題