How to Detect if User Uses AdBlock and Make a Decision Based on Response? [closed]

2

I have a problem with Ebit Banner When the user has some Adblocker installed it gets looped and overloads the browser because the page does not stop reloading and hangs I want to identify if the person has Adblock and, if so, neither load the banner, otherwise load normally.

I tried using FuckAdblock to do this, but when I have difficulty inserting the banner after the negative answer.

The code below is a summarized version of what the banner requires.

<param/> <!-- parâmetros do consumidor -->
<a id="bannerEbit"></a> <!-- Aqui é carregado o Banner com o background e o link -->
<script id="getSelo" src="ebit.com.br/getselo"> <!-- Chama o script do ebit -->
    
asked by anonymous 03.01.2018 / 16:18

1 answer

2

You can add the script that loads the banner via JavaScript into the function where AdBlock is not detected.

Normally place the <param> and <a id="bannerEbit"></a> tags in your HTML.

In the function where FuckAdblock detects that AdBlock does not exist, enter this code that will dynamically add the% of eBit to the page and will load the ad banner into the page:

function adBlockNotDetected() {
   var s = document.createElement("script");
   s.type = "text/javascript";
   s.src = "https://imgs.ebit.com.br/ebitBR/selo-ebit/js/getSelo.js?storeId&lightbox=true";
   s.id = "getSelo";
   document.body.appendChild(s);
}
  

In <script> , enter the information corresponding to your account.

FuckAdBlock Documentation

Detailed solution in this answer .

    
03.01.2018 / 17:24