New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove special handling of browsers with DNT enabled by default #13686
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We maybe should mention that in a changelog |
Suggested steps:
|
FYI It shouldn't be mentioned in the developer changelog I would say. It's not related to the platform. |
Also IE usage is nowadays at around 3% and maybe doesn't need to be mentioned in the browser report? And maybe only in the help text instead of footer to keep UI nice and clean and not clutter it with too unimportant things? Probably way more users are excluded with ad blockers etc |
That strongly depends on the website. Company intranets for example might have almost 100% IE in some cases. And especially those customers might need to change the Matomo config, as before the DNT setting didn't have any effect |
Maybe we could show that when people are using the type IntranetWebsite? Not many would use that type just yet but eventually will. Or maybe could look at whether 2018 yearly archive had eg at least 5% IE users and then could show it. It'd be just annoying to show it to everyone all the time when it's not really that valuable for 98% of the users. You can't show messages for every edge cases otherwise it ends up quite funny :) |
We provide business software for hospitals and have >66% IE11 users. |
I suppose best be to disable DNT then. For sure we shouldn't show the footer message to all users, only when IE 11 used to make a significant amount of traffic. Maybe someone could also develop a simple plugin to keep ignoring DNT for IE11 but not others |
@tsteur I think adding a plugin is the best way to handle the cases where the feature is needed (this way it is expected and users know the implications) Would it work to post an event like
here where plugins would get the user agent and detected DNT and then could return a boolean if the user should be tracked or not. (not sure if that is a bit too specific and if there is a more general way to make a plugin possible) |
Yes such an event would work. Eg |
refs #3531 |
I'm afraid, we might have a problem:
Can someone on iOS 12.2 or the next Mac OS beta please test, if this means that Apple stops sending the header at all (which would make their reason useless as they are now more identifiable than before) or if they just always send DNT:1 without a setting to change it. The latter would mean quite some issues as we couldn't merge this PR. |
Quickly checked browser stack but there iOS 12.1 is running btw here a bit more on the background: https://www.gizmodo.com.au/2019/02/apple-is-removing-do-not-track-from-safari/ |
I have now installed the 12.2 beta and indeed the option is gone. |
In theory this PR is ready, but I totally fail to get the plugin event to work. No matter what I change the Is there anything special a plugin has to do to work during tracking? <?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\IgnoreDNTByDefault;
use Piwik\Common;
use Piwik\Tracker\Request;
class IgnoreDNTByDefault extends \Piwik\Plugin
{
public function registerEvents() {
return array(
'PrivacyManager.shouldIgnoreDnt' => 'handleDNTHeader'
);
}
public function handleDNTHeader(&$shouldIgnore) {
Common::printDebug($shouldIgnore);
$shouldIgnore = $this->isUserAgentWithDoNotTrackAlwaysEnabled();
}
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',
);
}
} |
You need to add a method
It can't detect it is a tracker plugin cause the event it is listening to doesn't start with |
@tsteur Many thanks for the info, it works perfectly now. The plugin can be found here: https://github.com/Findus23/plugin-IgnoreDNTEnabledByDefault |
Totally missed this was merged. Did someone have time to test the plugin (https://github.com/Findus23/plugin-IgnoreDNTEnabledByDefault)? @fdellwing ? If so, I'd like to publish it before the release. |
fixes #9987
also fixes #3531
Now that we advertise that Matomo respects DNT, we should do this as precisely as possible.
Of course this makes Matomo less accurate (as now IE11 users that never enabled DNT, but had it enabled by default are not tracked anymore), but I think those browsers are becoming less relevant in the future and removing the special handling is easier than explaining the technical details to all Matomo users.
A move verbose compromise solution would be having an option or plugin that restores this behavior.