@Meowzz95 opened this Issue on January 12th 2020

HTTP request:

matomo.php?idgoal=0&revenue=15&ec_items=xxx&idsite=1&rec=1&uid=2

With this request called multiple times, matomo thinks the items are added multiple times for multiple users. Let's say we call it twice, the 'revenue left in cart' becomes 15*2 = 30 which is incorrect as user2 may just clear the cart and add the same item again.

But if we give an _id in the request like the following:

matomo.php?idgoal=0&revenue=15&ec_items=xxx&idsite=1&rec=1&uid=2&_id=294968cd032fe66a

Matomo knows user2 is just updating its own cart, revenue left in cart remains at 15 no matter how many times we call it, which is the expected behaviour.

If we MUST provide _id to make it work, how can we get the correct _id for any user? Another way of saying this is: what is the algorithm to generate _id base on other information?

Why must we provide _id here? Isn't uid enough to uniquely identify the user?

@tsteur commented on January 12th 2020 Member

Any chance you could apply these 2 changes files (or update to the latest beta):

We may have fixed this issue already.

Why must we provide _id here? Isn't uid enough to uniquely identify the user?

_id isn't needed to be provided but it is generally a good idea if possible. If the _id is not given, we can try & find the matching user using things like resolution, IP, browser, ... This was not working properly when a userId was set in 3.13. and is now fixed.

@Meowzz95 commented on January 13th 2020

Will try soon and update here

@Meowzz95 commented on January 13th 2020

Updating the above two files fixed the issue, thanks! I'll leave the issue open in case you want to close it only when the new version is released.

@tsteur commented on January 13th 2020 Member

Awesome, thanks for letting us know.

This Issue was closed on January 13th 2020
Powered by GitHub Issue Mirror