Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/Tracker')
-rw-r--r--core/Tracker/Request.php9
-rw-r--r--core/Tracker/Settings.php2
-rw-r--r--core/Tracker/VisitExcluded.php2
3 files changed, 11 insertions, 2 deletions
diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php
index 2b1496f451..50a8fa87e4 100644
--- a/core/Tracker/Request.php
+++ b/core/Tracker/Request.php
@@ -14,6 +14,7 @@ use Piwik\Container\StaticContainer;
use Piwik\Cookie;
use Piwik\Exception\InvalidRequestParameterException;
use Piwik\Exception\UnexpectedWebsiteFoundException;
+use Piwik\Http;
use Piwik\IP;
use Matomo\Network\IPUtils;
use Piwik\Piwik;
@@ -634,6 +635,14 @@ class Request
return Common::getRequestVar('ua', $default, 'string', $this->params);
}
+ public function getClientHints()
+ {
+ // use headers as default if no data was send with the tracking request
+ $default = Http::getClientHintsFromServerVariables();
+
+ return Common::getRequestVar('uadata', $default, 'json', $this->params);
+ }
+
public function shouldUseThirdPartyCookie()
{
return TrackerConfig::getConfigValue('use_third_party_id_cookie', $this->getIdSiteIfExists());
diff --git a/core/Tracker/Settings.php b/core/Tracker/Settings.php
index 74a66d0c65..cf1eba210d 100644
--- a/core/Tracker/Settings.php
+++ b/core/Tracker/Settings.php
@@ -39,7 +39,7 @@ class Settings // TODO: merge w/ visitor recognizer or make it it's own service.
$userAgent = $request->getUserAgent();
- $deviceDetector = StaticContainer::get(DeviceDetectorFactory::class)->makeInstance($userAgent);
+ $deviceDetector = StaticContainer::get(DeviceDetectorFactory::class)->makeInstance($userAgent, $request->getClientHints());
$aBrowserInfo = $deviceDetector->getClient();
if (empty($aBrowserInfo['type']) || 'browser' !== $aBrowserInfo['type']) {
diff --git a/core/Tracker/VisitExcluded.php b/core/Tracker/VisitExcluded.php
index 8d412cef26..ca6d64c7c5 100644
--- a/core/Tracker/VisitExcluded.php
+++ b/core/Tracker/VisitExcluded.php
@@ -190,7 +190,7 @@ class VisitExcluded
{
$allowBots = $this->request->getParam('bots');
- $deviceDetector = StaticContainer::get(DeviceDetectorFactory::class)->makeInstance($this->userAgent );
+ $deviceDetector = StaticContainer::get(DeviceDetectorFactory::class)->makeInstance($this->userAgent, $this->request->getClientHints());
return !$allowBots
&& ($deviceDetector->isBot() || $this->isIpInRange());