Replicates the user-signout mechanism from the PHP tracker in order to fix #7556
Tests pass except for the screenshot thing. Is that a signal or noise?
Tests pass except for the screenshot thing. Is that a signal or noise?
it's noise
Thanks for creating this Pull request @znerol :+1:
Feedback:
setNewVisitorId
: since User ID logout use case in Single Page Apps is the main use case for this method, maybe we call it resetUserId
(or unsetUserId
, or even logoutUserId
) if anyone has some thoughts?setUserId
method, let's not call the new method when user id is false. It's best to force users to call resetUserId
separately when needed. @znerol feel free to make the changes, otherwise we will likely work on this next month.
Update PR, I've opted for resetUserId
. It not only clears the user id but also generates a new visitor id. unsetUserId
does not really capture that bit. Also logoutUserId
could be misleading, we are not talking about privilege levels here.
Should I squash the commits? (Except for the minify piwik.js one.)
Thanks for updating the PR! fyi: It's not needed to squash commits as when we merge it will squash them.
Code review
after merge will need to update the documentation in: https://developer.matomo.org/api-reference/tracking-javascript
-> Check out the documentation for this new feature here: https://developer.matomo.org/guides/tracking-javascript-guide#when-user-logs-out-reset-user-id
it is available in Matomo 3.4.0 due to release today :tada: