Hello,
I'm new to piwik. I'hv installed piwik in my server, also enable E-commerce and want to track e-commerce of my wordpress woo-commerce site.
but its not working.
I'hv put this code in thankyou page:-
<script>
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://myoriginsai.com/possibilities/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
_paq.push(['addEcommerceItem',
<?php echo $order->id; ?>, // (required) SKU: Product unique identifier
<?php echo $itm['name']; ?>, // (optional) Product name
"Category", // (optional) Product category. You can also specify an array of up to 5 categories eg. ["Books", "New releases", "Biography"]
<?php echo $price; ?>, // (recommended) Product price
<?php echo $itm['qty']; ?> // (optional, default to 1) Product quantity
]);
_paq.push(['trackEcommerceOrder',
<?php echo $order->id; ?>, // (required) Unique Order ID
<?php echo $price; ?>, // (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)
<?php echo $itm['line_subtotal']; ?>, // (optional) Order sub total (excludes shipping)
<?php echo $itm['line_subtotal_tax']; ?>, // (optional) Tax amount
0, // (optional) Shipping amount
false // (optional) Discount offered (set to false for unspecified parameter)
]);
// we recommend to leave the call to trackPageView() on the Order confirmation page
_paq.push(['trackPageView']);
</script>
What is wrong with this code.
Please help me to track e-commerce...
Thank You.
I'm new to piwik. I'hv installed piwik in my server, also enable E-commerce and want to track e-commerce of my wordpress woo-commerce site.
but its not working.
I'hv put this code in thankyou page:-
<script>
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://myoriginsai.com/possibilities/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
_paq.push(['addEcommerceItem',
<?php echo $order->id; ?>, // (required) SKU: Product unique identifier
<?php echo $itm['name']; ?>, // (optional) Product name
"Category", // (optional) Product category. You can also specify an array of up to 5 categories eg. ["Books", "New releases", "Biography"]
<?php echo $price; ?>, // (recommended) Product price
<?php echo $itm['qty']; ?> // (optional, default to 1) Product quantity
]);
_paq.push(['trackEcommerceOrder',
<?php echo $order->id; ?>, // (required) Unique Order ID
<?php echo $price; ?>, // (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)
<?php echo $itm['line_subtotal']; ?>, // (optional) Order sub total (excludes shipping)
<?php echo $itm['line_subtotal_tax']; ?>, // (optional) Tax amount
0, // (optional) Shipping amount
false // (optional) Discount offered (set to false for unspecified parameter)
]);
// we recommend to leave the call to trackPageView() on the Order confirmation page
_paq.push(['trackPageView']);
</script>
What is wrong with this code.
Please help me to track e-commerce...
Thank You.