matomo-org/matomo-sdk-ios

Difference UserID en VisitorID

wiekep opened this issue · 3 comments

Hi, at our company we´re using a native SDK for our app application. While tracking and analyzing the raw data from the Matomo API, we analyzed two scenario´s; one in which the UserID has multiple visitor ID´s and one in which the visitorId's has multiple UserID's. Now we were wondering, what is the different between the UserID and VisitorID? And which one do we need to track the unique users visiting our app our a specific page?

Like to hear from you,
Wieke

Hi @wiekep,

thanks for your question.
The visitorID is an identifier generated upon first initialization of the SDK and will not be changed after that. It is persisted in the UserDefaults. This value can in theory be overridden by setting the forcedVisitorId but unless you do that it shouldn't change.
The userId is a way to identify users across multiple devices and installations. It will only be set if you set the userId manually.
A few more details can be found in the Readme.

Does this help?

If I don't set my userId, does the SDK generate one by default? I heard this is the default behavior on Android but I don't know for iOS

No, the SDK doesn't generate a userId itself but it does generate a visitorId.