donni106 / matomo-tracker-react-native

Stand alone library for using Matomo tracking in React Native and Expo projects.
MIT License
47 stars 15 forks source link

Problem on merging signed out users when the user id (uid) is undefined #15

Closed BatDroid closed 1 year ago

BatDroid commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

I have an application on which user gets logged out frequently. After entrance user gets logged in immediately. I want things like AppStart and events before logging in be merged with the user id which has been after that. As far as I remember Matomo did that based on the ip address of the user but recently the problem is that I'm facing is that all of my users, when they are logged out, their events are considered as one single visitor which is undefined(or null if I pass that).

Screenshot 2023-03-03 at 2 24 54 PM

I looked over this issue and reached to this link applied what is suggested but still have the issue unless I comment this line of code the issue is fixed. I know that i's not a good solution to remove it but maybe it can be changed to something like this:

...(this.userId ? {uid: this.userId}: {}),

I'll make a PR for that so that if you wanted it can be merged, otherwise I guess I'll need to use my forked repo for that.

thank you in advance

donni106 commented 1 year ago

Thanks for the description and opening an issue. With quick read it sounds quite well and the code change makes sense to me. I am looking forward to merge and include it soon!