I have upgraded my tracking for Google Analytics to Universal Analytics as suggested by GA team. I made the following changes to the GA module by Miva Merchant.
Replaced the old GA code in the GA code tab to and moved the token to the <head> tag.
also added the new universal GA code for ecommerce in the GA ecommerce tab. This part of the code is still in global footer.
I am getting orders but they are not getting tracked by GA.
What am I missing or doing wrong.
Thanks
Replaced the old GA code in the GA code tab to and moved the token to the <head> tag.
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', 'xx-xxxxxxxx', 'auto'); ga('send', 'pageview'); </script>
Code:
<script type="text/javascript"> ga('require', 'ecommerce', 'ecommerce.js'); ga('ecommerce:addTranscation', { '&mvt:ga_transaction:order_id;', // transaction ID - required '&mvt:ga_transaction:store_name;', // affiliation or store name '&mvt:ga_transaction:order_total;', // total - required '&mvt:ga_transaction:total_tax;', // tax '&mvt:ga_transaction:total_ship;', // shipping '&mvt:ga_transaction:ship_city;', // city '&mvt:ga_transaction:ship_state;', // state or province '&mvt:ga_transaction:ship_cntry;' // country }); <mvt:foreach iterator="item" array="ga_transaction:orderitems"> ga('ecommerce:addItem', { '&mvt:item:order_id;', // transaction ID - required '&mvt:item:code;', // SKU/code - required '&mvt:item:name;', // product name '&mvt:item:cancat_code;', // category or variation '&mvt:item:price;', // unit price - required '&mvt:item:quantity;' // quantity - required }); </mvt:foreach> ga('ecommerce:send'); //submits transaction to the Analytics servers </script>
What am I missing or doing wrong.
Thanks
Comment