How to block adblock? [duplicate]

9

I'm building a site that works with ads and so I can not allow a user to enter adblock, I tried to use the www.antiblock.org script but it only works on one page, another page where I work with navigation without refresh using ajax it blocks the main div and sometimes the whole site even though adblock is off, has anyone else used this script or did you already have this problem?

D

    
asked by anonymous 17.04.2016 / 20:27

3 answers

16

There is no 100% technique, but there are some recommended:

Checking the size of an element

function detectAddNotLoaded() {
    if ($('.foo_dd').height() == 0) {
        // Aqui vc toma a decisão. Mostrar um aviso, redirecionar, etc...
    }
}

$(document).ready(function(){
    detectAddNotLoaded();
});


<div class="foo_dd"><script>
//aqui deve mostrar um banner, mas o adblock bloqueia.
//A ideia é verificar a altura. Se for ZERO, possivelmente não foi carregado devido ao adblock
</script></div>

<div class="foo_dd"><script>
//aqui deve mostrar um outro banner
</script></div>

Against: A user without adblock enters the page and the banners may not load due to an eventual failure or may take a long time to load.

The advantage over the next example is that it becomes more consistent against more sophisticated blockers that do not block files by nomenclature (ads.js, .js, etc.)

Loading a locked file

The technique is to load a url whose name is blocked by the blockers.

The logic is, the ajax request will fail because the blocker will prevent access to "/js/ads.js".

   $.ajax({
            url: "/js/ads.js",
            dataType: "script"
        })
        .fail(function () {
           // Aqui vc toma a decisão. Mostrar um aviso, redirecionar, etc...
        });

The ads.js file may be empty.

Blockers typically seek to block anything that is named ads.js, advertisement.js, and related names. So that's the logic.

Contra: The ajax request may fail for N reasons. Think of the user who has no blocker and then the ajax happens to fail.

Considerations

For both examples, the contra points have a small probability of combinations.

The above examples are not definitive solutions, nor do they claim this. Be aware that there are other ways to solve (read "get as close as you can to the desirable"). Blockers change the algorithms periodically to fit the market just as the ads also fit the market and seek to protect themselves from blockers. It is a constant "war".

Finally, which decision to make depends on each case.

Evaluate the pros and cons for your case.

    
17.04.2016 / 21:09
15

There is no technical solution that can get past a technique that is active with privileges in the browser. There are some palliatives that usually bring more problems than solutions.

The most that the person does is detect that the advertising has been blocked and make some decision. Even this is not universal, it may stop working and is not considered very suitable. In fact, there are already blockers that do not allow scripts of the page to detect whether or not the ad was displayed. It can even block some action that prevents content from being displayed because the advertisement has been removed. Already has a blocker, not yet "commercial" that makes the accepted answer and the duplicate unfeasible.

The user has the right to block what he does not want to see, just as he can do it in other media. Forcing it, even more in times than telephony operators wanting to impose traffic limit, is unethical and perhaps even legal intervention will do so.

The recommendation is to do nothing. Like all protection, there is always a way to cheat, and the mechanism ends up causing problems for everyone, including those who accept advertising. When someone thinks they have found a definitive solution, much more quickly than they invented this solution, they find one that ends the protection. It is silly to want to make protections in digital media where third parties have access to every context where it is being executed.

My suggestion is to make advertising part of the content, so it's hard to block. But no one wants to do this because it's work. Want to make easy money with advertising? Accept that it will be easily blocked. Or look for another template that does not depend on the most active users who do not.

    
17.04.2016 / 20:49
11

If your site lives on ads and you do not want to allow access without them, you must first create a usage policy and inform the user.

I have seen some sites that show a popup asking you to accept as a contract, saying that you will not block popups from that site. You can explicitly suggest that the user add the site as an exception in AdBlocker.

In general, as @bigown said, it's not really cool to block users simply by using AdBlocker. For example, if a news site does this to me I simply go to another site.

However, if the content you provide is something more specific and unique, it might not be such a big deal, users will eventually want to accept it anyway.

Finally, consider advertising that gives money if there is volume. It may not make up for the work of blocking AdBlocker simply because you will not make money by forcing more people to see the advertisements. It is better to invest in making the site better, faster, friendly, useful and relevant and thus attract more people who, besides watching, will click on the links.

In practice, you can use AdBlocker detection techniques as in Daniel's response and take some action not to let the user see the page. But as I said, this will require work.

One way is to load all content via AJAX. First you load the advertisements and then only the normal content. If the first fails, you show some warning to the user.

    
19.04.2016 / 05:25