diff options
Diffstat (limited to 'plugins/CoreHome/Tracker/VisitRequestProcessor.php')
-rw-r--r-- | plugins/CoreHome/Tracker/VisitRequestProcessor.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/CoreHome/Tracker/VisitRequestProcessor.php b/plugins/CoreHome/Tracker/VisitRequestProcessor.php index cb8bc98e3b..e4e5a2ddf8 100644 --- a/plugins/CoreHome/Tracker/VisitRequestProcessor.php +++ b/plugins/CoreHome/Tracker/VisitRequestProcessor.php @@ -19,6 +19,7 @@ use Piwik\Tracker\Settings; use Piwik\Tracker\Visit\VisitProperties; use Piwik\Tracker\VisitExcluded; use Piwik\Tracker\VisitorRecognizer; +use Piwik\Plugins\PrivacyManager\Config as PrivacyManagerConfig; /** * Encapsulates core tracking logic related to visits. @@ -91,8 +92,15 @@ class VisitRequestProcessor extends RequestProcessor return true; } + $privacyConfig = new PrivacyManagerConfig(); + + $ip = $request->getIpString(); + if ($privacyConfig->useAnonymizedIpForVisitEnrichment) { + $ip = $visitProperties->getProperty('location_ip'); + } + // visitor recognition - $visitorId = $this->userSettings->getConfigId($request, $request->getIpString()); + $visitorId = $this->userSettings->getConfigId($request, $ip); $request->setMetadata('CoreHome', 'visitorId', $visitorId); $isKnown = $this->visitorRecognizer->findKnownVisitor($visitorId, $visitProperties, $request); |