PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / trunk
Matomo Analytics – Powerful, Privacy-First Insights for WordPress vtrunk
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 / IgnoreCookie.php
matomo / app / core / Tracker Last commit date
Config 4 months ago Db 3 months ago Handler 2 years ago Visit 1 month ago Action.php 3 months ago ActionPageview.php 2 years ago BotRequest.php 3 months ago BotRequestProcessor.php 1 month ago Cache.php 6 months ago Db.php 1 year ago Failures.php 6 months ago FingerprintSalt.php 1 year ago GoalManager.php 1 month ago Handler.php 2 years ago IgnoreCookie.php 1 year ago LogTable.php 1 year ago Model.php 6 months ago PageUrl.php 2 weeks ago Request.php 1 month ago RequestHandlerTrait.php 4 months ago RequestProcessor.php 1 month ago RequestSet.php 6 months ago Response.php 3 months ago ScheduledTasksRunner.php 1 year ago Settings.php 3 months ago TableLogAction.php 6 months ago TrackerCodeGenerator.php 1 year ago TrackerConfig.php 1 month ago Visit.php 3 months ago VisitExcluded.php 3 months ago VisitInterface.php 3 months ago Visitor.php 1 month ago VisitorNotFoundInDb.php 1 month ago VisitorRecognizer.php 1 year ago
IgnoreCookie.php
90 lines
1 <?php
2
3 /**
4 * Matomo - free/libre analytics platform
5 *
6 * @link https://matomo.org
7 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
8 */
9 namespace Piwik\Tracker;
10
11 use Piwik\Config;
12 use Piwik\Cookie;
13 use Piwik\ProxyHttp;
14 /**
15 * Tracking cookies.
16 *
17 */
18 class IgnoreCookie
19 {
20 /**
21 * Get tracking cookie
22 *
23 * @return Cookie
24 */
25 private static function getTrackingCookie()
26 {
27 $cookie_name = @Config::getInstance()->Tracker['cookie_name'];
28 $cookie_path = @Config::getInstance()->Tracker['cookie_path'];
29 $cookie = new Cookie($cookie_name, null, $cookie_path);
30 $domain = @Config::getInstance()->Tracker['cookie_domain'];
31 if (!empty($domain)) {
32 $cookie->setDomain($domain);
33 }
34 return $cookie;
35 }
36 public static function deleteThirdPartyCookieUIDIfExists()
37 {
38 $trackingCookie = self::getTrackingCookie();
39 if ($trackingCookie->isCookieFound()) {
40 $trackingCookie->delete();
41 }
42 }
43 /**
44 * Get ignore (visit) cookie
45 *
46 * @return Cookie
47 * @throws \Exception
48 */
49 public static function getIgnoreCookie()
50 {
51 $cookie_name = @Config::getInstance()->Tracker['ignore_visits_cookie_name'];
52 $cookie_path = @Config::getInstance()->Tracker['cookie_path'];
53 $cookie = new Cookie($cookie_name, "+ 30 years", $cookie_path, \false);
54 $domain = @Config::getInstance()->Tracker['cookie_domain'];
55 if (!empty($domain)) {
56 $cookie->setDomain($domain);
57 }
58 return $cookie;
59 }
60 /**
61 * Set ignore (visit) cookie or deletes it if already present
62 */
63 public static function setIgnoreCookie()
64 {
65 $ignoreCookie = self::getIgnoreCookie();
66 if ($ignoreCookie->isCookieFound()) {
67 $ignoreCookie->delete();
68 } else {
69 $ignoreCookie->set('ignore', '*');
70 if (ProxyHttp::isHttps()) {
71 $ignoreCookie->setSecure(\true);
72 $ignoreCookie->save('None');
73 } else {
74 $ignoreCookie->save('Lax');
75 }
76 }
77 self::deleteThirdPartyCookieUIDIfExists();
78 }
79 /**
80 * Returns true if ignore (visit) cookie is present
81 *
82 * @return bool True if ignore cookie found; false otherwise
83 */
84 public static function isIgnoreCookieFound()
85 {
86 $cookie = self::getIgnoreCookie();
87 return $cookie->isCookieFound() && $cookie->get('ignore') === '*';
88 }
89 }
90