none
Filtering ad blocking browser exceptions

    Question

  • In looking at browser exceptions for my website, they are hammered with exceptions from ad sites, and I would surmise this is because a user has ad blocking extensions in their browser.   I use Disqus on part of my site, which has crap pointing to some of these ad services.

    For example:

    The only legit exception I have here are the 2 from openweathermap.org.

    What would be the best way of filtering or not even collecting these exceptions for the other items in the first place? My site also has it's own webapi and of course internal javascript methods, and if I can filter based on that it would at least get me looking at my own code.

    Saturday, March 30, 2019 11:50 AM

All replies

  • Thanks for reaching out! We're working on this and will have an answer for you soon!
    Monday, April 1, 2019 8:24 PM
    Moderator
  • You can leverage Telemetry Initializer in JS SDK to filter out telemetry before it is sent to Application Insights.

    From the doc:

    "The input argument to addTelemetryInitializer is a callback that takes a ITelemetryItem as an argument and returns a boolean or void. If returning false, the telemetry item is not sent, else it proceeds to the next telemetry initializer, if any, or is sent to the telemetry collection endpoint."

    var telemetryInitializer = (envelope) => {
      envelope.data.someField = 'This item passed through my telemetry initializer';
    };
    appInsights.addTelemetryInitializer(telemetryInitializer);

    By checking some value and returning false in Telemetry Initializer, you should be able to filter our certain telemetry.


    Dmitry Matveev

    Tuesday, April 2, 2019 1:49 AM
    Owner