This article has moved to a new home. View the updated version

Google Analytics with eCommerce Tracking



All Neto websites come pre-loaded with the correct scripts for eCommerce tracking.

This article contains the latest scripts from Google Analytics should you need to revert any changes made. It also has the correct codes for eCommerce tracking pre-installed which will automatically work with any live website as long as eCommerce Tracking is enabled in your Google Analytics account settings.

To make sure you have the most up to date scripts installed:

  1. From the Neto Dashboard navigate to Setup & Tools > All Settings & Tools.



  2. Select Analytics & 3rd Party Scripts from the side menu and choose Custom Scripts.



  3. Select the pre-installed option for Google Analytics.



    Use the following information below to to update it to the latest tracking scripts.

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

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

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


  • Last Modified: 28/09/2017 Neto Version: 6.10