I had a couple questions about how to setup ecommerce tracking with the new API. I was following this topic at first How to set up ecommerce tracking?, but it seems the API used there is deprecated, and v2 API seems a bit confusing to me.
On my site’s cart page there is an input for the quantity of each product where you could easily add or remove a lot of each product. I was wondering how to implement the v2 API’s ecommerceAddToCart() and ecommerceRemoveFromCart() methods with this. Both need a quantity parameter to add/remove, meanwhile I only have a value for what it currently is; so it would be a lot easier for me to just call ecommerceCartUpdate(), however the Getting Started page for ecommerce tracking says it should only be called once per session and only for returning visitors. That is a problem for me!
So should I do something like: storing the value before the quantity in the input changes, then when it changes calculate the difference and if the new value is less it means products were removed so I call removefromcart, otherwise I call addtocart? There’s also the fact that since it is so easy to add/remove big quantities, I was wondering if it really makes sense to make so many calls? Is there a chance that one of these calls won’t go through and there will be a discrepancy between what is actually in the cart vs what Piwik last tracked?
EDIT: I forgot there was another question I had:) If I don’t track additions/removals at all on Piwik’s side, can I still call ecommerceOrder() if I can pass products in the cart from my site’s database? It seems like at least in the v1 version of the API you had to ‘register’ products with Piwik before updating the cart or confirming an order.