最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Google Analytics ecommerce tracking not working - Stack Overflow

programmeradmin5浏览0评论

The code is provided below. I include it in the thank you page.

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

What is the issue?

<!-- GOOGLE ANALYTICS ECOMMERCE CONVERSION TRACKING -->
<!--  -->

<script>

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

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

ga('emerce:send');

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

The code is provided below. I include it in the thank you page.

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

What is the issue?

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

<script>

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

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

ga('emerce:send');

</script>
<!-- END: GOOGLE ANALYTICS CONVERSION TRACKING -->
Share Improve this question edited Mar 3, 2014 at 0:27 Charles 51.5k13 gold badges106 silver badges144 bronze badges asked Mar 1, 2014 at 11:06 chuckfinleychuckfinley 2,59510 gold badges34 silver badges42 bronze badges 2
  • 1 Do you include analytics.js also ? - I don't think transaction tracking will work without that. – Eike Pierstorff Commented Mar 1, 2014 at 18:23
  • did you wait 24 hours, before checking the standard reports? – Linda Lawton - DaImTo Commented Mar 2, 2014 at 17:19
Add a ment  | 

2 Answers 2

Reset to default 4

I have integrated emnerce code in my project and it is working fine for me. below I have added the code.

 <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./analytics.js','ga');

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

ga('emerce: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('emerce: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>

Please go through the given link for more details : emerce tracking code

Happy Coding.. :-)

You must activate the GA - emerce option.

GA : Admin -> Emerce Settings -> Enable Emerce -> Status : ON

发布评论

评论列表(0)

  1. 暂无评论