If you have gone through some of previous blog, you might have seen how to install google analytics, e-commerce tracking and conversion tracking in various CMS like Magento, Shopify and so on.
In this blog, you are going to see how to add universal analytics tracking code as e-commerce tracking code on Miva Merchant Center. Since Google analytics is getting much more popular in digital marketing and e-commerce analysis, that’s why Miva has given one individual module to implement google analytics tracking (Asynchronous Google Analytics Tracking Code ) as well as e-commerce tracking.
There is 3 main steps to install universal google analytics and e-commerce tracking code:
- Enable Google Analytics module( option).
- Upgrade to Universal Google Analytics Code.
- Upgrade to Universal Google Analytics E-commerce Tracking Code.
Enable Google Analytics module
To Enable Google Analytics Module follow all below steps:
- Login to Miva Merchant Admin.
- Click on utility (menus in left of admin panel).
- Search for google analytics and check Google Analytics option.
- Click on update button( Bottom of the page).
After clicking on update button you will get 3 new Tab- Google Analytics Settings
- Google Analytics Tracking Code
- Google Analytics Ecommerce Tracking Code
- To enable Google analytics:
Click on Google Analytics setting tab and add Google analytics Tracking ID(e.g UA-XXXXXX-X) in box and click on update button.
Upgrade to Universal Google Analytics Code.
By default, Asynchronous Google Analytics Tracking code along with E-commerce Tracking code will get Installed on your website after following above steps.
To upgrade Asynchronous to Universal Google Analytics code click on Google Analytics Tracking Code Tab then click on Advance mode link.
Replace the code of Main Template box to blow code then click on update button.
<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','https://www.google-analytics.com/analytics.js','ga'); ga('create','&mvt:ga_tracking:google_id;','auto'); ga('send','pageview'&mvt:ga_tracking:url_override;); </script>
Upgrade to Universal E-commerce Code.
Since Google Analytics Tracking code have been upgraded to Universal Tracking Code, now only one thing is left to upgrade i.e Asynchronous E-commerce Tracking code to universal Tracking code.
To upgrade e-commerce tracking code follow below steps:
Click on Google Analytics E-commerce Tracking Code Tab.
Replace the code in Ecommerce Tracking Template box with below code.
<script type="text/javascript"> ga('require', 'ecommerce', 'ecommerce.js'); ga('ecommerce:addTransaction', { id: '&mvt:ga_transaction:order_id;', // Transaction ID - this is normally generated by your system. affiliation: '&mvt:ga_transaction:store_name;', // Affiliation or store name revenue: '&mvt:ga_transaction:order_total;', // Grand Total shipping: '&mvt:ga_transaction:total_ship;' , // Shipping cost tax: '&mvt:ga_transaction:total_tax;' // Tax. }); <mvt:foreach iterator="item" array="ga_transaction:orderitems"> ga('ecommerce:addItem', { id: '&mvt:item:order_id;', // Transaction ID. sku: '&mvt:item:code;', // SKU/code. name: '&mvt:item:name;', // Product name. category: '&mvt:item:cancat_code;', // Category or variation. price: '&mvt:item:price;', // Unit price. quantity: '&mvt:item:quantity;' // Quantity. }); </mvt:foreach> ga('ecommerce:send'); </script>
Congratulation,If you have completed above steps because you have successfully upgraded your Google Analytics Tracking code along with Ecommerce Tracking Code.
Note: I have implement these codes on multiple website and it is working fine, still if you are getting any error feel free to edit these code or leave your comment via comment box or Get in touch form. Also your valuable feedback will be heartily appreciated .
Thanks for writing. helped me to upgrade my tracking code . Also I would like to mention, this blog is really neat and clean. Hope I will get more from you. Can I get your contact details.
Good to hear that this blog helped you.
if you want some other help you can contact me anytime.
Dead indited written content, Really enjoyed reading through.