PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 1.0.5
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v1.0.5
5.12.0 5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / core / Tracker / Settings.php
matomo / app / core / Tracker Last commit date
Db 6 years ago Handler 6 years ago TableLogAction 6 years ago Visit 6 years ago Action.php 6 years ago ActionPageview.php 6 years ago Cache.php 6 years ago Db.php 6 years ago Failures.php 6 years ago GoalManager.php 6 years ago Handler.php 6 years ago IgnoreCookie.php 6 years ago LogTable.php 6 years ago Model.php 6 years ago PageUrl.php 6 years ago Request.php 6 years ago RequestProcessor.php 6 years ago RequestSet.php 6 years ago Response.php 6 years ago ScheduledTasksRunner.php 6 years ago Settings.php 6 years ago TableLogAction.php 6 years ago TrackerCodeGenerator.php 6 years ago TrackerConfig.php 6 years ago Visit.php 6 years ago VisitExcluded.php 6 years ago VisitInterface.php 6 years ago Visitor.php 6 years ago VisitorNotFoundInDb.php 6 years ago VisitorRecognizer.php 6 years ago
Settings.php
128 lines
1 <?php
2 /**
3 * Piwik - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 *
8 */
9 namespace Piwik\Tracker;
10
11 use Piwik\Config;
12 use Piwik\Container\StaticContainer;
13 use Piwik\Tracker;
14 use Piwik\DeviceDetector\DeviceDetectorFactory;
15 use Piwik\SettingsPiwik;
16
17 class Settings // TODO: merge w/ visitor recognizer or make it it's own service. the class name is required for BC.
18 {
19 const OS_BOT = 'BOT';
20
21 /**
22 * If `true`, the config ID for a visitor will be the same no matter what site is being tracked.
23 * If `false, the config ID will be different.
24 *
25 * @var bool
26 */
27 private $isSameFingerprintsAcrossWebsites;
28
29 public function __construct($isSameFingerprintsAcrossWebsites)
30 {
31 $this->isSameFingerprintsAcrossWebsites = $isSameFingerprintsAcrossWebsites;
32 }
33
34 public function getConfigId(Request $request, $ipAddress)
35 {
36 list($plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF,
37 $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie) = $request->getPlugins();
38
39 $userAgent = $request->getUserAgent();
40
41 $deviceDetector = StaticContainer::get(DeviceDetectorFactory::class)->makeInstance($userAgent);
42 $aBrowserInfo = $deviceDetector->getClient();
43
44 if (empty($aBrowserInfo['type']) || 'browser' !== $aBrowserInfo['type']) {
45 // for now only track browsers
46 unset($aBrowserInfo);
47 }
48
49 $browserName = !empty($aBrowserInfo['short_name']) ? $aBrowserInfo['short_name'] : 'UNK';
50 $browserVersion = !empty($aBrowserInfo['version']) ? $aBrowserInfo['version'] : '';
51
52 if ($deviceDetector->isBot()) {
53 $os = self::OS_BOT;
54 } else {
55 $os = $deviceDetector->getOS();
56 $os = empty($os['short_name']) ? 'UNK' : $os['short_name'];
57 }
58
59 $browserLang = substr($request->getBrowserLanguage(), 0, 20); // limit the length of this string to match db
60
61 return $this->getConfigHash(
62 $request,
63 $os,
64 $browserName,
65 $browserVersion,
66 $plugin_Flash,
67 $plugin_Java,
68 $plugin_Director,
69 $plugin_Quicktime,
70 $plugin_RealPlayer,
71 $plugin_PDF,
72 $plugin_WindowsMedia,
73 $plugin_Gears,
74 $plugin_Silverlight,
75 $plugin_Cookie,
76 $ipAddress,
77 $browserLang);
78 }
79
80 /**
81 * Returns a 64-bit hash that attemps to identify a user.
82 * Maintaining some privacy by default, eg. prevents the merging of several Piwik serve together for matching across instances..
83 *
84 * @param $os
85 * @param $browserName
86 * @param $browserVersion
87 * @param $plugin_Flash
88 * @param $plugin_Java
89 * @param $plugin_Director
90 * @param $plugin_Quicktime
91 * @param $plugin_RealPlayer
92 * @param $plugin_PDF
93 * @param $plugin_WindowsMedia
94 * @param $plugin_Gears
95 * @param $plugin_Silverlight
96 * @param $plugin_Cookie
97 * @param $ip
98 * @param $browserLang
99 * @return string
100 */
101 protected function getConfigHash(Request $request, $os, $browserName, $browserVersion, $plugin_Flash, $plugin_Java,
102 $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF,
103 $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie, $ip,
104 $browserLang)
105 {
106 // prevent the config hash from being the same, across different Piwik instances
107 // (limits ability of different Piwik instances to cross-match users)
108 $salt = SettingsPiwik::getSalt();
109
110 $configString =
111 $os
112 . $browserName . $browserVersion
113 . $plugin_Flash . $plugin_Java . $plugin_Director . $plugin_Quicktime . $plugin_RealPlayer . $plugin_PDF
114 . $plugin_WindowsMedia . $plugin_Gears . $plugin_Silverlight . $plugin_Cookie
115 . $ip
116 . $browserLang
117 . $salt;
118
119 if (!$this->isSameFingerprintsAcrossWebsites) {
120 $configString .= $request->getIdSite();
121 }
122
123 $hash = md5($configString, $raw_output = true);
124
125 return substr($hash, 0, Tracker::LENGTH_BINARY_ID);
126 }
127 }
128