commit 7183ebdd9724544973fe4336ecdf57cb457a496c Author: Lukas Winkler Date: Sun Feb 10 21:03:39 2019 +0100 initial version diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5e40b36 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +## Changelog + +### 0.1.0 + +initial version \ No newline at end of file diff --git a/IgnoreDNTEnabledByDefault.php b/IgnoreDNTEnabledByDefault.php new file mode 100644 index 0000000..05898ed --- /dev/null +++ b/IgnoreDNTEnabledByDefault.php @@ -0,0 +1,61 @@ + 'handleDNTHeader' + ); + } + + public function isTrackerPlugin() { + return true; + } + + public function handleDNTHeader(&$shouldIgnore) { + $shouldIgnore = $this->isUserAgentWithDoNotTrackAlwaysEnabled(); + } + + /** + * @return bool + */ + public function isUserAgentWithDoNotTrackAlwaysEnabled() { + $request = new Request($_REQUEST); + $userAgent = $request->getUserAgent(); + $browsersWithDnt = $this->getBrowsersWithDNTAlwaysEnabled(); + foreach ($browsersWithDnt as $userAgentBrowserFragment) { + if (stripos($userAgent, $userAgentBrowserFragment) !== false) { + return true; + } + } + return false; + } + + /** + * Some browsers have DNT enabled by default. For those we will ignore DNT and always track those users. + * + * @return array + */ + protected function getBrowsersWithDNTAlwaysEnabled() { + return array( + // IE + 'MSIE', + 'Trident', + // Maxthon + 'Maxthon', + + // Epiphany - https://github.com/matomo-org/matomo/issues/8682 + 'Epiphany', + ); + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..4614186 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Matomo IgnoreDNTByDefault Plugin + +## Description + +Before 3.9.0 Matomo ignored the DoNotTrack setting in Internet Explorer, Maxthon and Epiphany as these browsers have enabled it by default without any interaction by users. + +If a significant fraction of your website vistors use these browsers and are missing in your reports because of this change, you can install this plugin to restore the old behaviour. diff --git a/plugin.json b/plugin.json new file mode 100644 index 0000000..7f8ca67 --- /dev/null +++ b/plugin.json @@ -0,0 +1,28 @@ +{ + "name": "IgnoreDNTEnabledByDefault", + "description": "restore the behaviour of Matomo <=3.8.0", + "version": "0.1.0", + "theme": false, + "require": { + "piwik": ">=3.9.0,<4.0.0-b1" + }, + "authors": [ + { + "name": "Lukas Winkler", + "email": "lukas@matomo.org", + "homepage": "https://lw1.at" + } + ], + "support": { + "email": "lukas@matomo.org", + "issues": "https://github.com/Findus23/plugin-IgnoreDNTEnabledByDefault/issues", + "forum": "https://forum.matomo.org", + "source": "https://github.com/Findus23/plugin-IgnoreDNTEnabledByDefault" + }, + "homepage": "https://matomo.org", + "license": "GPL v3+", + "keywords": [ + "privacy", + "donottrack" + ] +} \ No newline at end of file