Quantcast
Channel: Matomo forums - Latest topics
Viewing all articles
Browse latest Browse all 13990

Elegant way to Override Core functions?

$
0
0

@joneduca wrote:

Hi,

We would need to override the behaviour of a Core function and were wondering what is the most elegant way to do it.

Especifically we need to change function getVisitorId in Core/Tracker/Request.php. In this function if a UserId is received by the tracker, a visitorId is created based on the hashed UserId. We need that the visitorId that is used is the one received in the cookie and not based on the UserID.

Therefore we would comment the following lines:
// If User ID is set it takes precedence
$userId = $this->getForcedUserId();
if ($userId) {
$userIdHashed = $this->getUserIdHashed($userId);
$idVisitor = $this->truncateIdAsVisitorId($userIdHashed);
Common::printDebug("Request will be recorded for this user_id = " . $userId . " (idvisitor = $idVisitor)");
$found = true;
}

Is there a way to change this without modifying it in the Core and preventing to loose these changes with future Piwik version updates?

Thank you in advance

Jon

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 13990

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>