1
0
Fork 0
mirror of https://github.com/Findus23/plugin-IgnoreDNTEnabledByDefault.git synced 2024-08-27 19:52:17 +02:00

initial version

This commit is contained in:
Lukas Winkler 2019-02-10 21:03:39 +01:00
commit 7183ebdd97
Signed by: lukas
GPG key ID: 54DE4D798D244853
4 changed files with 101 additions and 0 deletions

5
CHANGELOG.md Normal file
View file

@ -0,0 +1,5 @@
## Changelog
### 0.1.0
initial version

View file

@ -0,0 +1,61 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\IgnoreDNTEnabledByDefault;
use Piwik\Tracker\Request;
class IgnoreDNTEnabledByDefault extends \Piwik\Plugin
{
public function registerEvents() {
return array(
'PrivacyManager.shouldIgnoreDnt' => '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',
);
}
}

7
README.md Normal file
View file

@ -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.

28
plugin.json Normal file
View file

@ -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"
]
}