Skip to content
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

When AdBlock Plus is used, suggest user to disable it for Piwik #5094

Closed
mattab opened this issue May 5, 2014 · 11 comments
Closed

When AdBlock Plus is used, suggest user to disable it for Piwik #5094

mattab opened this issue May 5, 2014 · 11 comments
Assignees
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone

Comments

@mattab
Copy link
Member

mattab commented May 5, 2014

Adblock plus creates issues when used for Piwik app. AdblockPlus blocks some javascript from executing because of their filenames and/or path. It catches false positive in the Piwik user interface.

This was reported many times over, for example here.

Proposal

  • Detect adblock plus is used, and show a warning/notification on the screen asking to disable it
  • Contact Adblock plus team, and kindly ask them to fix their regex for piwik
@mattab mattab added this to the 2.x - The Great Piwik 2.x Backlog milestone Jul 8, 2014
@mattab mattab modified the milestones: Mid term, Long term Oct 11, 2014
@tsteur
Copy link
Member

tsteur commented Sep 11, 2015

👍 for this. Many will open Piwik and even demo.piwik.org and just think that it doesn't work

@mattab mattab modified the milestones: 2.15.0, Long term Sep 11, 2015
@mattab mattab added c: Usability For issues that let users achieve a defined goal more effectively or efficiently. and removed Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. labels Sep 11, 2015
@hpvd
Copy link

hpvd commented Sep 11, 2015

one should do this detection really carefully
There are lot's of methods out there which work with adding blacklisted words e.g. "advertise" to the website code the see if this is blocked.
Doing this here would be like honey and we will have problems with many many other tools/extension...

@hpvd
Copy link

hpvd commented Sep 11, 2015

I would suggest to understand why parts of piwik-backend are blocked

  • for website frontend with piwik script inside - it's clear: they would like to prevent any tracking
  • but why are there now problems with Piwik's backend?

@hpvd
Copy link

hpvd commented Sep 11, 2015

so it should be possible to completely disable this function and making EVERY SINGLE part of this code invisible on the website (for those who would not like to play with honey when there are bees outside)

@mattab
Copy link
Member Author

mattab commented Sep 15, 2015

Also experienced in forums: http://forum.piwik.org/read.php?2,129115

Ublock Origin is now blocking the content within Piwik admin area.
Add your admin panel url ot the white list of Ublock Origin, restart the browser and it works again.
Maybe it worth to add it to the FAQ as Ublock Origin is quite popular now.

@mattab
Copy link
Member Author

mattab commented Oct 1, 2015

There are tricks to detect adblocker is running eg. http://stackoverflow.com/a/24111206

But we want to detect whether the adblocker is currently blocking some of the Piwik JS content, as many ad blockers will correctly let Piwik dashboard render, so we shouldn't notify users in that case.

@diosmosis diosmosis assigned diosmosis and unassigned diosmosis Oct 7, 2015
@ThaDafinser
Copy link
Contributor

There are 100 ways javascript or Piwik can be broken. So i would suggest a more general solution.

What about saving a list of the .js files which should get loaded in the HTML main file.
Then after the onload event is fired check if all are loaded.

When something is wrong, then display the user some possible solutions: Piwik cannot work, because some Scripts werde blocked. Do you have enabled AdBlock? Do you have enable another blocking addon?

@tsteur
Copy link
Member

tsteur commented Oct 8, 2015

When development mode is disabled, we have only one or two files to load but I like that idea which I had not thought about before. Eg we could check something like if !$('#content:visible') or if !$('#content').text(). Not sure if it works though. Need to check how they block the content exactly.

We will need to embed this code into the HTML page as it might not be executed otherwise

@tsteur
Copy link
Member

tsteur commented Oct 8, 2015

I checked Dashboard and Admin area with Ublock Origin extension in Chrome and Firefox, with development mode enabled and disabled but couldn't reproduce. Can anyone reproduce it and let me know if there are any configurations to be done?

@tsteur
Copy link
Member

tsteur commented Oct 8, 2015

FYI: The following terms are blocked eg by easyprivacy list:

/piwik-$domain=~piwik.org
/piwik.$script,domain=~piwik.org
/piwik.php
/piwik/js/*$domain=~piwik.org
/piwik1.
/piwik2.js
/piwik_
/piwikapi.js
/piwikC_
/piwikTracker.

So using eg this URL results in no js file being loaded: http://apache.piwik/piwik_1/

The requests actually start but never finish, not sure how we can detect this in general. Also it always depends on the Piwik URL etc which Piwik files will be loaded and which not. Eg when using http://apache.piwik as URL all files are loaded unless one enables development mode. Then eg piwik-api.js won't be loaded but also 2 other files.

adblock

@tsteur
Copy link
Member

tsteur commented Oct 8, 2015

I worked on a detection but it's not trivial as maybe all JavaScript files are blocked and we cannot rely on anything.

How it works:

  • To have it work in development mode enabled and disabled I set var hasBlockedContent = false; in piwik-api.js
  • Add the end of the page we check whether hasBlockedContent was set to false and if not, there might be an ad blocker used. It could be as well a 404 or some other problems that are not related to ad block
  • To increase the chances that there is an ad block active we check whether an element having the id bottomAd was set to display:none or has height:0. If this is the case we presume there is an ad block active and show a red, bold message at the bottom. The message is at the bottom in case we detected it wrong to keep. One will still notice it at some point, especially if all content was blocked.

Why do we not only do the bottomAd check?
We would maybe detect an adblock that does not block any of our files, in this case we should not show the message as our detection of bottomAd doesn't have to be 100% right.

Do we detect all ad blocker?
Maybe, possibly not. I don't know if all Ad blocker work like "uBlock Origin" by blocking requests. Also we only show the warning if we detected the bottomAd block correctly. There might be ad blocker that do this differently. I think it's better to show the red warning message only when we are very sure about an ad blocker being active and not when there are maybe other reasons like an HTTP 404.

How does the ad blocker block our content?
See screenshot above but it depends on the browser. In Chrome an error "ERR_BLOCKED_BY_CLIENT" appears in the developer tools. I tried to detect such errors but seems not possible. Eg tried by using window.onerror, script.onerror and many others without success. Also did not find something about this.

How does the warning look?
It depends on which files are loaded as it might load some files in development mode and result can very.

When all files are blocked it possibly looks like this
screenshot at oct 082

If only some files are blocked it can look like this
screenshot at oct 083

@tsteur tsteur self-assigned this Oct 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

5 participants