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.9k stars 2.65k forks source link

Average price in ecommerce product view's total row shows sum instead of average (bug related to tracking product views) #16441

Open RaphaelBergmann opened 4 years ago

RaphaelBergmann commented 4 years ago

This should be the average average price, not the sum of all average prices. Matomo-Version: 3.14.1 MySQL-Version: 10.1.45-MariaDB-0+deb9u1 PHP-Version: 7.4.10 image

tsteur commented 4 years ago

Thanks for reporting this @RaphaelBergmann I tried to reproduce this in various of our sites but couldn't.

It also seems to work in our public demo https://demo.matomo.org/index.php?module=CoreHome&action=index&idSite=62&period=day&date=yesterday#?idSite=62&period=day&date=yesterday&segment=&category=Goals_Ecommerce&subcategory=Goals_Products

Can you maybe sort by average price and check if there are some high priced items in one of the 622 entries?

RaphaelBergmann commented 4 years ago

I sorted the table, but there're no high priced items... We also have this issue here with sorting, which could refer to values being stored incorrectly in the DB (sth about number formatting, 12.345,67 €?). We have a very basic installation with just two plugins (FormAnalytics and MarketingCampaignsReporting) but disabling both of them doesn't fix our two issues. Or maybe it has something to do with MariaDB handling things slightly differently? image

tsteur commented 4 years ago

@RaphaelBergmann can you reproduce the issue on our demo? https://demo.matomo.org/index.php?module=CoreHome&action=index&idSite=62&period=day&date=yesterday#?idSite=62&period=day&date=yesterday&segment=&category=Goals_Ecommerce&subcategory=Goals_Products

If the sorting is an issue to not show the high prices maybe try to select in the bottom right "500 rows" and then you should be able to see all prices over two pages so it might be easier to find any high prices (if there are any).

RaphaelBergmann commented 4 years ago

Your demo is running fine, I can't reproduce my issue there. I checked for high prices again, but couldn't find any. Even checked the table _matomo_log_conversionitem. I thought about things that are specific to our shop: We have items that cost 0, where its average price would be 0 too, and perhaps its a 0 / NULL problem. Perhaps you could add a $0 item to your demo shop? Also, we have 0 as well as negative revenues in _matomo_logconversion, e.g. if someone uses a voucher.

tsteur commented 4 years ago

@RaphaelBergmann how are you tracking the ecommerce data?

Are you viewing the "Ecommerce orders" view there? image

Is there any segment applied? I checked... generally the price is divided by the number of orders and I'm seeing a lot of products there but barely any orders so I'm assuming the problem is maybe that the average should only sum prices of products with orders vs in your case it might also sum products without orders. Might be related to tracking "product views".

RaphaelBergmann commented 4 years ago

We use JavaScript for eCommerce tracking, e.g. this for product views: image and this for conversion tracking (on the "thankyou"-page): image My screenshots above all show the "Ecommerce Orders", not the "Abandoned Carts". I was already wondering about items with 0 purchases in the products list. However, the "Abandoned Carts" view shows the same behavior: image Applying a segment de- or increases the numbers as expected, but even without a segment, the average item prices are still summed.

tsteur commented 4 years ago

@RaphaelBergmann is there any chance we could get view access to this site to try and understand things better? It's still not quite clear to me how this happens. The tracking requests itself look good to me and shouldn't cause an issue. If that's possible, could you create a log in for us for hello at matomo.org and send the details to that email address?

RaphaelBergmann commented 4 years ago

@tsteur yes, there is a chance - I just sent an email regarding this... Thanks so far :)

RaphaelBergmann commented 4 years ago

@tsteur I just sent you the credentials :)

tsteur commented 4 years ago

Thanks @RaphaelBergmann it appears to me that it is related to tracking product views. Like Matomo would some up all the product prices then device it by the number of orders. And it would also sum the price of products that had no order for example.