Published on .MVC Madness (http://www.mvcmadness.com)
Tracking Miva Merchant Traffic and Sales Using Google Analytics Part III

By: Brennan Heyde Published On: 11/24/2007

Part III – Advanced Analytics: Analytics for E-Commerce

This is part III of a three part series on Google Analytics. You can read part I and II here:

Part I – Installing Google Analytics in Miva Merchant
Part II – Advanced Analytics: Goal Tracking

In part I, we walked you through setting up Google Analytics. In part II we showed you how to set up goals and track your checkout process through goal visualization. Now in part III we are going to show you how to set up Analytics for E-Commerce, which will allow you to see customer conversion rates, average order value, and which traffic sources bring in the most revenue. These are just a few of the many advanced features available in Analytics for E-Commerce. 

With analytics for e-commerce, you can see very important data such as sources of revenue. Knowing which traffic sources bring in the most income allow you to focus your marketing and further target your customers.

How to setup and install Analytics for E-Commerce using Miva Merchant

The first step to install Analytics for E-Commerce is to enable it in your Google Analytics account. By default it is not enabled.

  1. Login to you Analytics account
  2. Click the “edit” link for your domain
  3. In the “Main Website Profile Information” section click the edit button on the right
  4. Click “Yes” for E-Commerce website

Now that you have enabled Analytics for e-commerce you need to add special tracking code to you Miva Invoice screen.

Login to your Miva Merchant admin.

If you are using Miva 5, navigate to the INVC page (invoice page) under the pages section.

If you are using Miva 4 with OUI then you want to click on "Hdr/Ftr - Checkout Screens"

In order to track the customer purchase data need to add a hidden form to your footer of your invoice page.

Miva 5 Instructions:

In the INVC page right before the </mvt:item></html> tags add the following code.

    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">
  _uacct = "UA-99999-9";
  urchinTracker();
</script>

<form style="display:none;" name="utmform">
<textarea id="utmtrans">
UTM:T|<mvt:if expr="NOT ISNULL l.settings:order:id">&mvt:order:id;</mvt:if>|&mvt:global:affiliate;|&mvt:order:total;|<mvt:foreach iterator="charge" array="order:charges"><mvt:if expr="l.settings:charge:type EQ 'TAX'">&mvt:charge:amount;</mvt:if></mvt:foreach>|<mvt:foreach iterator="charge" array="order:charges"><mvt:if expr="l.settings:charge:type EQ 'SHIPPING'">&mvt:charge:amount;</mvt:if></mvt:foreach>|&mvt:global:customer:ship_city;|&mvt:global:customer:ship_state;|&mvt:global:customer:ship_cntry;
<mvt:foreach iterator="item" array="order:items">
UTM:I|<mvt:if expr="NOT ISNULL l.settings:order:id">&mvt:order:id;</mvt:if>|&mvt:item:code;|&mvt:item:name;|category|&mvt:item:price;|&mvt:item:quantity;
</mvt:foreach>
</textarea>
</form>

The Code above loops through the contents of your customers order and prints out important information into a hidden form on the page. Google Analytics uses this information to collect data about each order.
Please make sure you replace the first section of the code with YOUR Analytics tracking code. This is the same code that you should have in your global footer of Miva.

 

Miva 4 Instructions:

In the Invoice Footer, add the following code:

%OUI%

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-XXXXXXX-XX";
urchinTracker();
</script>

<form style="display:none;" name="utmform"><textarea id="utmtrans">

UTM:T|%ORDERNUM%|Your Store Name |%order_total%|%order_tax%|%order_shipping%|%order_ship_city%|%order_ship_state%|%order_ship_cntry%

%FUNC(OrderItem_FindFirst_Order(Orders.d.id))%
%WHILE(g.OUIX_FuncReturn)%
UTM:I|%ORDERNUM%|%VAR(OrderItems.d.code)%|%VAR(OrderItems.d.name)%|Category|%VAR(OrderItems.d.price)%|%VAR(OrderItems.d.quantity)%
%FUNC(OrderItem_FindNext_Order(Orders.d.id))%
%WHILEEND%

The last step is to add a JavaScript OnLoad event to the body tag. If you already implemented the Goal Conversion outlined in Part II of this series, then this part is already done.

 Add this code to your global body tag:

Miva 5:

<mvt:elseif expr="(g.screen EQ 'INVC')">
<body onLoad="javascript:__utmSetTrans()">
</mvt:if>

Miva 4:

%OUI%

%IF(g.screen EQ 'INVC' and (NOT g.Data_Entry_Error))%
 onload="javascript:__utmSetTrans()"
%IFEND%

Your Analytics for E-Commerce is now complete. Wait a few days for Google to gather some data and you should be bombarded with a wealth of information to help you improve your Miva Store Sales.

Sources: I used Sebenza's Google Analytics tutorial as well as this forum post to create this tutorial.

About the Author: Brennan Heyde is an e-commerce consultant working in San Diego, Ca. He specializes in online marketing and SEO for e-commerce.  Have a struggling e-commerce website? – Contact Brennan today for a site analysis.


Source URL: http://www.mvcmadness.com/content/tracking-miva-merchant-traffic-and-sales-using-google-analytics-part-iii