title: How To Integrate Woocommerce With Piwik
body: <p>Currently, I have setup tracking on my wordpress website using piwik. However, on top of that, I need to be able to track the e-commerce conversion and abandoned cart. I have managed to track the conversion manually but I have no idea on how do I replace the hardcoded values with the "woocommerce ordered products" values.</p>
  
  <p>Here are what have I done so far:</p>
  
  <ol>
  <li>Installed WP-Piwik</li>
  <li>Installed WooCommerce Piwik integration</li>
  <li><p>I created my custom javascript, called "piwik.js", and  I hardcoded the values to track e-commerce purchases.</p>
  
  <pre><code>function addEcommerceItem() {
  // add the first product to the order
      _paq.push(['addEcommerceItem',
      "sku01", // (required) SKU: Product unique identifier
      "sku01Name", // (optional) Product name
      "productCategory", // (optional) Product category. You can also specify an array of up to 5 categories eg. ["Books", "New releases", "Biography"]
      60, // (recommended) Product price
      1 // (optional, default to 1) Product quantity
      ]);
      alert("e-Commerce item added!");
   };
  
   function trackEcommerceOrder() {       
      _paq.push(['trackEcommerceOrder',
      "A10000127", // (required) Unique Order ID
      35, // (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)
      30, // (optional) Order sub total (excludes shipping)
      5.5, // (optional) Tax amount
      4.5, // (optional) Shipping amount
      false // (optional) Discount offered (set to false for unspecified parameter)
      ]);
    alert("item tracked!");
    };
  </code></pre></li>
  <li><p>On my Woocommerce, checkout page:</p>
  
  <pre><code>   [woocommerce_checkout]
     &lt;script type="text/javascript" src="http://myServerIP/mySite/piwik.js"&gt;&lt;/script&gt;
     &lt;script type="text/javascript"&gt;
        addEcommerceItem(); 
        trackEcommerceOrder(); 
     &lt;/script&gt;
  </code></pre></li>
  <li><p>And again, my question was how do I replace hardcoded values in <code>addEcommerceItem()</code> and <code>trackEcommerceOrder()</code> to reflect whatever products being purchased through my woocommerce site dynamically?</p></li>
  </ol>
  
  <p>Thank you in advance</p>