matomo-org / matomo-sdk-android

SDK for Android to measure your apps with Matomo. Works on Android phones, tablets, Fire TV sticks, and more!
BSD 3-Clause "New" or "Revised" License
393 stars 164 forks source link

Reset UserId while logged out #259

Closed JeyakumarThangaraj closed 2 years ago

JeyakumarThangaraj commented 5 years ago

Team,

We dont find anyway to reset userId while logout. because of this, visitor id remain same for all the time whenever same user is trying to login. Kindly Advise

Thanks, Jeyakumar

d4rken commented 5 years ago

What about Tracker.setUserId(...).

https://github.com/matomo-org/matomo-sdk-android/blob/006ed7dfb4541273adc43bbd315bcd955dc32379/tracker/src/main/java/org/matomo/sdk/Tracker.java#L334

JeyakumarThangaraj commented 5 years ago

If i reset user Id, new visitor ID and a new visit is not created. Still existing visit only being used. Kindly advise. I want below to be implemented in android.

image

d4rken commented 5 years ago

resetUserId also resets the visitor-id in the javascript tracker

So to do the analog here you'd probably have to do something like:

tracker.setUserId(null)
tracker.setVisitorId(Tracker.makeRandomVisitorId())

Also see SESSION_START (i.e. new_visit), which you could set to prevent the server from attempting any visit stitching.

TrackHelper.track(TrackMe().set(QueryParams.SESSION_START,1))
    .screen("/").title("Main screen")
    .with(getTracker())
Nithiyasabariswaran commented 5 years ago

Hi All,

All my screens are loading in a single visitor id (Android). I have used tracker.setVisitorId(Tracker.makeRandomVisitorId()) also.

kinldy advice, Thanks in advance.

image

mattab commented 4 years ago

resetUserId also resets the visitor-id in the javascript tracker

Fyi @d4rken we recently changed this and no longer will resetUserId change the Visitor ID. This was done in https://github.com/matomo-org/matomo/pull/14360

hannesa2 commented 2 years ago

Solved with #373 If not, please reopen it