javascript - Google Analytics Track Order not visible and not working on Google Chrome -


when run code on google chrome not working , not view in page view source , not able track order while code working , visible in page view source on firefox , can track order on google analytics dashboard.

so, please suggest me doing wrong. code given below.

thanks in advance.

**********ecommerce tracking sample 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.com/analytics.js’,’ga’);    ga(‘create’, ‘ua-xxxxxx-12’, ‘auto’);    ga(‘require’, ‘ecommerce’, ‘ecommerce.js’);    ga(‘ecommerce:addtransaction’, {  ‘id’: ‘1234’, // transaction id. required.  ‘affiliation’: ‘skinny jeans’, // store name.  ‘revenue’: ‘28.8’, // total revenue.  ‘shipping’: ‘10.00’, // shipping.  ‘tax’: ‘1.89’ // tax.  });    ga(‘ecommerce:additem’, {  ‘id’: ‘1234’, // transaction id. required. same in transaction data.  ‘name’: ‘okejeans’, // product name. required.  ‘sku’: ‘skj49’, // product sku.  ‘category’: ‘men jeans’, // product category or variation.  ‘price’: ‘76.65’, // product price.  ‘quantity’: ‘1’ // product quantity.  });    ga(‘ecommerce:send’);    ga(‘send’, ‘pageview’);    </script>

your code has incorrect quotes , reversed order of transaction , items.

(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-xxxxxx-12', 'auto');  ga('require', 'ecommerce', 'ecommerce.js');   ga('ecommerce:additem', { 'id': '1234', // transaction id. required. same in transaction data. 'name': 'okejeans', // product name. required. 'sku': 'skj49', // product sku. 'category': 'men jeans', // product category or variation. 'price': '76.65', // product price. 'quantity': '1' // product quantity. });  ga('ecommerce:addtransaction', { 'id': '1234', // transaction id. required. 'affiliation': 'skinny jeans', // store name. 'revenue': '28.8', // total revenue. 'shipping': '10.00', // shipping. 'tax': '1.89' // tax. });  ga('ecommerce:send');  ga('send', 'pageview'); 

it seems work.

enter image description here


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -