Closed philippkeller closed 2 years ago
Hi Philipp ! Thanks for using our package.
I think you're misusing the visitorId in both those cases. The visitorId used by matomo is supposed to be a completely unique identifier for this user in your application, unrelated to his user instance. In the basic implementation in the package, we used the uuid package to generate them. If you don't enter a visitorId when initializing your instance of MatomoTracker, it will actually create a visitorId through it.
It is then automatically saved for future instances of the application through shared_preferences if you don't force a specific visitorId in the future.
It shouldn't be linked to your Firebase user nor on your Firebase database. If your user wipes the data of their application on their phone, this specific visitor should never be seen again.
You can however send the Firebase's uuid along your tracking events, by using some of its content parameters, such as eventAction
or another String parameter you don't currently use.
I hope it helps and solves both your problems !
Ah I see! visitorId is closer to a session, whereas what I want to configure is a user.
I would like to be able to "cross link" a Flutter app user and a web user. Since they would use the same Firebase user I thought I would use the same visitorId both in Flutter and on Web. But seems that this is not the way to do it.
Is there a way I can send the user id so the Matomo UI understands it and then links the two users together?
Update: I think I found what I was looking for: https://matomo.org/faq/reports/set-up-user-id-tracking-in-matomo/
You're very right !
We don't support userIds currently though. But I will add support for it in the next hour or so, just the time for me to add the necessary code, and for @TesteurManiak to review, merge and publish it.
Stay tuned!
wow, this is super amazing! I saw that this repo was active, but this is now exceeding all my expectations 🚀
Good news, matomo_tracker
is now published in its 1.2.1
version and should add support for adding an userId. Tell us if it's fine for you !
Floating Dartists are going sonic speed 😎
Yes, this works! For the record, that's how I used it with Firebase:
String userId = auth.currentUser?.email ?? auth.currentUser!.uid;
MatomoTracker.instance.setVisitorUserId(userId);
It might be worth a mention in the README? Thanks a ton for adding it so fast 🙏
Definitely adding it to the readme for future usecases. But glad you could confirm it working to us !
First: thanks so much for creating/supporting this flutter package. That was one of the reasons I chose Matomo, because there is a current flutter SDK for it.
Now, I'm using Firebase and I'm running into two problems:
uuid
which I'd like to put into visitorId, but Firebase's uuid has 26 characters (hex) whereas visitorId in matomo is required to be 16 characters. I guess I could just take the 16 last characters of Firebase and hope that they are unique. Or is there any better alternative?MatomoTracker.instance.initialize
first without visitorId and then after registration I call it again? Or should I useMatomoTracker.instance.visitor = Visitor(id: _visitorId, userId: _visitorId)
?