matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.91k stars 2.65k forks source link

The empty shopping cart is used as an abandonedCart, which bothers me #20315

Open Chenjiujiu opened 1 year ago

Chenjiujiu commented 1 year ago

When a user adds a product to the website, but then removes the product, and then leaves the site when the shopping cart is empty, it is regarded as a abandoned shopping cart, which bothers me My site will update the shopping cart when it is opened, which makes my site a abandoned shopping cart every time I visit it (unless he completes the order and turns it into a revenue shopping cart). I'm crazy 图片 图片

sgiehl commented 1 year ago

Hi @Chenjiujiu. What exactly would you expect from Matomo to handle this? Do you think we should discard shopping carts on Matomo side if they don't have a value or quantity?

Chenjiujiu commented 1 year ago

@sgiehl Thank you for your reply:! I know that clearEcommerceCart() can be used to empty the shopping cart,But it can't cancel the shopping cart. I hope a new hook can cancel the shopping cart of matomo,Then I can send the cancel shopping cart hook when the shopping cart is empty

webian commented 1 year ago

@sgiehl I strumbled upon the same problem.

I think an emptied cart shouldn't be considered abandoned.

Also, Matomo logic to update the cart is "silly". To add an item I can't simply use 'addEcommerceItem' for the product added but I have to call it for every item in the cart. Practically I have to tell to Matomo how the cart is filled every time the user update the cart. This is really impractical.

If the user then removes the last product that was in the cart, Matomo still think that this product is in the cart unless I call clearEcommerceCart() but that leaves an abandoned cart in the stats.

With UA and GA4 you simply need to send the updated data (product and q.ty added or removed) not the whole cart.

sgiehl commented 1 year ago

@webian I fully agree that this could be simplified and improved. Our product team will consider this for future improvements.

webian commented 1 year ago

I add that while testing a way to avoid the incorrect abandoned cart, I found that just calling trackEcommerceCartUpdate() creates an abandoned cart.

nogamenofun98 commented 1 year ago

I also have this issue when integrating the tracking cart logic. I written the logic to detect if cart is empty, then call clearEcommerceCart() but I found out that it doesnt show 0 quantity in matomo there.

So I tried clear cart + trackEcommerceCartUpdate(), and this time it does show 0 quantity but it remain as abandoned cart record. I cant find any logic to totally remove the abandoned cart record.

Is there any temporary solution to remove it? (I using self hosted on premise version)

Or at least the analytics part, exclude those abandoned cart with quantity 0 and total value 0? image

sgiehl commented 1 year ago

I'm not aware a a technical solution to fully remove such abandoned carts. Technically it might still be an abandoned cart, as the user previously had items in his cart. But from an analytics point of view it might indeed make sense to at least ignore such carts when generating the reports.

webian commented 1 year ago

In my opinion, a cart is only to be considered abandoned if it has objects inside it. If the user empties the cart, it is as if the user goes back to the initial situation when the cart was still empty and at that time the cart was not considered abandoned.

So it is not only in statistical terms that it should not be considered abandoned, but also in technical terms.

If, for example, a user places an item in the cart by mistake and then removes it, these actions should not be considered.