Search code examples
adblock

How to trace or log blocked sites by Adblock Plus?


I wonder if there is a way to trace or log, programatically, blocked websites by Adblock Plus. Adblock Plus show only the number of blocked websites but it would be of great to know which website is blocked by log or trace Adblock Plus blocking.


Solution

  • With the current version (2.6.9.0), you can't log blocked sites in Adblock Plus. The best thing you can do is add this feature yourself. This works for Firefox but the same can be done in other browsers.

    • Download the source code https://hg.adblockplus.org/adblockplus/archive/tip.zip
    • Unzip it and modifiy the file lib/contentPolicy.js in the function processNode (which check whether a node should be blocked) at line 255.

      if (match){ FilterStorage.increaseHitCount(match, wnd); console.log('ABP blocked '+ node +' with '+ location); }

    • Add the following line at the begin of lib/contentPolicy.js Components.utils.import('resource://gre/modules/devtools/Console.jsm');
    • Build the module with

      ./build.py build

    • Install the module and open the browser console CTRL+SHIFT+J (don't confuse with the web console CTRL+SHIFT+K)
    • Enjoy