NOTE: You can also share shopping cart updates with more control (e.g. adding/removing single items), check out this article.
This script needs to be fired every time a user is adding, updating or deleting a product from the cart. It needs to contain all products found in the cart, even the products not updated by the current "Add to cart" click. You can add multiple items by adding multiple addEcommerceItem functions. Again, the variables ({{name}}, {{sku}}, etc.) mentioned below need to be dynamically filled with the data of the item.
<script type="text/javascript">
_paq.push(['addEcommerceItem',
"{{sku}}",
"{{name}}",
"{{categoryname}}",
{{price}},
{{quantity}}
]);
// Here it is important to add all other products found in the cart, even the products not updated by the current "Add to cart" click
_paq.push(['trackEcommerceCartUpdate',
{{totalcartvalue}}
]);
_paq.push(['trackPageView']);
</script>
Shopping cart script example with two products
<script>
_paq.push(['addEcommerceItem',
"9780786706211",
"Endurance: Shackleton's Incredible Voyage",
["Adventure Books", "Best sellers"],
8.8,
2
]);
_paq.push(['addEcommerceItem',
"7659837658343",
"Nike Shoe",
"Shoes",
70,
1
]);
_paq.push(['trackEcommerceCartUpdate',
87.6
]);
_paq.push(['trackPageView']);
</script>