New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Sorting Product Revenue in Ecommerce not working #21829
Comments
Hi @enual, I was unable to create this on demo.matomo.cloud or locally running 5.0.1. Has it just been reported by a single user or have you been able to recreate the issue too? |
@bx80 this customer provided their Matomo instance access and was able to replicate it while logged in to their dashboard. |
This has been reported before:
And I also have an instance, where this sorting is behaving in a weird way. |
Since this has been reported several times and we've not managed to reliably reproduce it, I think we should schedule some time for a detailed investigation to find out what is happening. I'll request a priority assessment from the product team 👍 |
Hi @sgiehl - yes, it's already returned from the API in a wrong order: Call URI: /index.php?module=API&method=Goals.getItemsName&expanded=1&idSite=7&period=day&date=yesterday&abandonedCarts=0&format=JSON&token_auth=XXX&force_api_session=1&filter_sort_column=nb_visits&filter_sort_order=desc |
@peterbo Thanks for this. That makes it a bit easier where to look for a possible problem. Maybe for some weird reason the |
@peterbo I think I might have found a possible reason. Is the instance that has the problem rather old and was set up before Matomo 4.0? Furthermore is the CustomVariables plugin installed and ecommerce metrics were tracked as custom variables before - or maybe still are for some reason? |
Hi @sgiehl! I'm not really knowledgeable about the track history of this specific instance (the contact person on the client's side as well) and don't have any FTP access. I can only see these infos in the system check: Matomo Version | 4.12.2 CustomVariables Plugin is not installed. |
It might be connected with columns, that do not have any values in all rows, e.g. if a product was sold without any prior visits to its product page: but it's hard to really do strcutured testing with that. At least I can say that sorting the nb_visits column works, if all rows have integer values. **UPDATE: No, that's probably not the case. Other days, also having non-defined row values, sort in a correct way. |
Hm. ok. I thought it might be caused by this special handling that is only applied for installs that were set up prior to Matomo 4: Lines 364 to 366 in 6199cd6
Guess I need to look for another possible reason then. |
Actually that could be the case. It looks like the archives that are built might not contain certain metrics for some products. So if no product views were tracked for a product, there might not be a My assumption would be that sorting works correctly if the first row of an archive has all columns. @peterbo Could you maybe check that on your instance? |
Ok. I finally found the reason why this is happening. In addition most of the metrics are internally stored with metric ids instead of their names. When tables are sorted, the sorter checks if the provided metric to sort by exists in the first row. If this isn't the case the metric name is converted to the metric id and checked again. If it works the metric id will be used instead. So a problem only occurs when the first row of a table does not have the metric it should be sorted by. Imho there are multiple ways to fix this:
|
That sounds like a quite valid explanation for what's happening. Thank you, @sgiehl for the effort, you've put into finding this! |
What happened?
When a customer click Product Revenue to sort it out from low to high, what's being sorted alphabetically is the product name.
What should happen?
When you click Product Revenue in Ecommerce, it should be sorted numerically and not the Product name.
How can this be reproduced?
This can be reproduce by logging in to Matomo > Ecommerce > Product.
Matomo version
5.0.1
PHP version
8.2.14
Server operating system
Ubuntu 22.04
What browsers are you seeing the problem on?
Chrome
Computer operating system
Windows
Relevant log output
No response
Validations
The text was updated successfully, but these errors were encountered: