Issue with Hashing user id to visitor id in version 3.13.3

I am setting userId when the user logs in to the site. When i want to fetch visitorId in my crm for that particular userId, i hash(sha1) the userid and get visitor id.

From the docs, I can see “*User ID will be converted (hashed) into a Visitor ID hexadecimal string.”
In version 3.12.0, in /var/www/matomo/core/Tracker/Visit.php on line 553
// User ID takes precedence and overwrites idvisitor value
$userId = $this->request->getForcedUserId();
if ($userId) {
$userIdHash = $this->request->getUserIdHashed($userId);
$binIdVisitor = Common::hex2bin($userIdHash);
$this->visitProperties->setProperty(‘idvisitor’, $binIdVisitor);
$valuesToUpdate[‘idvisitor’] = $binIdVisitor;

This is where hashing is done.
This code seems to be missing in v3.13.3
and hence i m not able to fetch proper visitor id.

Is this intended change or a bug?


Thanks for your feedback. unfortunately our user guide was out of date, and we’ve now updated the text to remove this part.
As of today this is the text:

If a [User ID][7] is set, either via setUserId in your favorite SDK or via &uid= in the Tracking API, then we will look first for visits where the log_visit.idvisitor matches this Visitor ID. If no visit is matched, we look for visits where either the log_visit.user_id matches the User ID, or where log_visit.config_id matches the visitor fingerprint.

This was changed in UserID no longer overwrites VisitorId by MichaelHeerklotz · Pull Request #14360 · matomo-org/matomo · GitHub
and is being discussed as a BC break which we may want to mitigate eventually, in User-ID: Unique Visitor is not recognized even with the same User-ID · Issue #15593 · matomo-org/matomo · GitHub