Google Analytics and E-commerce Tracking in Miva Merchant

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.

Miva Merchant
Miva Merchant

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).
Miva Merchant Google Analytics Utility
Miva Merchant Utility
  • Search for google analytics and check Google Analytics option.
Miva Merchant Google Analytics enable
Miva Merchant Google Analytics Enable
  • 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.
Miva Merchant Google Analytics enabling
Miva Merchant Google Analytics Enabling

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.

Miva Merchant – Google Analytics Tracking Code
Miva Merchant – Google Analytics Tracking Code

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.

Miva Merchant Google Analytics Ecommerce Tracking Code
Miva Merchant – Google Analytics Ecommerce Tracking Code

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 .

3 thoughts on “Google Analytics and E-commerce Tracking in Miva Merchant

  1. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.