Google's eCommerce reports allow you to analyse purchase activity on your website. You can see product and transaction information, average order value, conversion rate, time to purchase, and other data.
Please Note: This article also applies to Universal Analytics.
To see eCommerce data in Google Analytics , you will need to:
- Enable eCommerce in your Google Analytics reports.
- Add code to your website to collect eCommerce data.
This article will now guide you through the steps of adding the code to your website.
Set up Google analytics with eCommerce Tracking
To make sure you have the most up to date scripts installed:
-
In your Maropost Commerce control panel navigate to Settings & Tools > All Settings & Tools.
-
Select Analytics & 3rd Party Scripts from the side menu and choose Custom Scripts.

-
Select the pre-installed option for Google Analytics.

Use the following information below to to update it to the latest tracking scripts.
-
Replace the code on the Page Header tab with the below:
<!-- Google Analytics -->
<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', '[@REFERRAL_KEY1@]', 'auto');
[%IF [@CONFIG:CHECKOUT_COMPLETED@] %]
ga('send', 'pageview', {
'page': '/purchase/invoice.html'
});
[%/IF%]
</script>
<!-- End Google Analytics -->
-
Replace the code on the Purchase Confirmation (Thank You Page) tab with the below:
<!-- Start Google E-commerce Tracking -->
[%SHOW_ORDER id:'[@ORDER_ID@]'%]
[%PARAM *header%]
<script type="text/javascript">
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
'id': '[%URL_ENCODE%][@ORDER_ID@][%END URL_ENCODE%]', // Transaction ID. Required.
'affiliation': '[%URL_ENCODE%][@CONFIG:WEBSITE_NAME@][%END URL_ENCODE%]', // Affiliation or store name.
'revenue': '[@GRAND_TOTAL@]', // Grand Total.
'shipping': '[@shipping_price@]', // Shipping.
'tax': '[@tax_total@]' // Tax.
});
[%END PARAM%]
[%PARAM *body%]
ga('ecommerce:addItem', {
'id': '[%URL_ENCODE%][@ORDER_ID@][%END URL_ENCODE%]', // Transaction ID. Required.
'name': '[%URL_ENCODE%][@MODEL@][%END URL_ENCODE%]', // Product name. Required.
'sku': '[%URL_ENCODE%][@SKU@][%END URL_ENCODE%]', // SKU/code.
'category': '[%URL_ENCODE%][@CATEGORY_NAME@][%END URL_ENCODE%]', // Category or variation.
'price': '[@PRICE@]', // Unit price.
'quantity': '[@QTY@]' // Quantity.
});
[%END PARAM%]
[%PARAM *footer%]
ga('ecommerce:send');
</script>
[%END PARAM%]
[%END SHOW_ORDER%]
<!-- End Google E-commerce Tracking -->
-
Replace the code on the Page Footer tab with the below:
<!-- Start Google E-commerce Tracking -->
[%IF [@CONFIG:CHECKOUT_COMPLETED@] eq ''%]
<script>
[%IF [@CONFIG:GA_FUNNEL_VALUE@]%] ga('send', 'pageview', '[@CONFIG:GA_FUNNEL_VALUE@]'); [%ELSE%] ga('send', 'pageview');[%/IF%]
</script>
[%/IF%]
<!-- End Google E-commerce Tracking -->
After making the above changes login to your Google Analytics account, go to the Real Time tracking section and check to see that visitors are being tracked.