Piwik e-commerce tracking in Shopify

Install Piwik Script

Normal Page:

Online Store -> Themes -> Edit HTML/CSS

Image 8

Image 9

 

Checkout Page (Checkout process is completed)

Settings -> Checkout -> Additional content and scripts:

Image 10

<!-- Piwik checkout  -->
<script type="text/javascript">
  var _paq = _paq || [];

  _paq.push([
	'trackEcommerceOrder',
	"{{ order_number }}",
	{{ total_price | money_without_currency }}
  ]);

  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  //_paq.push(['trackGoal', 1, 50]);

  (function() {
    var u="https://analytics.sandwichm.com/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', 2]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript><p><img src="//analytics.sandwichm.com/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

 

Reference:

  1. Short codes to get order information:
    https://docs.shopify.com/manual/configuration/store-customization/page-specific/checkout-page/thankyou-page/add-conversion-tracking-to-thank-you-page#tracking-orders
  2. Piwik e-commerce tracking guide:
    http://piwik.org/docs/ecommerce-analytics/#ecommerce-tracking
  3. Piwik – How to create a goal:
    http://piwik.org/docs/tracking-goals-web-analytics/
  4. Manually trigger goal:
    http://developer.piwik.org/guides/tracking-javascript-guide#manually-trigger-goal-conversions
  5. Shopify Checkout object (system variables):
    https://docs.shopify.com/themes/liquid-documentation/objects/checkout