Hello, I'm trying to implement the ebit banner but I'm having problems with adBlocks. In my previous question ( Banner of ebit with error 404 and infinite loop with adblock turned on ) I was able to implement fuckAdBlock to block the ads, but it is not recognizing when adBlock is not activated. Only after several refreshs on the page does it work.
This is my code:
document.addEventListener("DOMContentLoaded", function(){
function adBlockNotDetected() {
console.log('anuncio NAO bloqueado');
}
// Function called if AdBlock is detected
function adBlockDetected() {
//>>esta bloqueando mesmo sem o adBlock estar ativo<<
console.log("Anuncios bloqueados");
}
if(typeof fuckAdBlock !== 'undefined' || typeof FuckAdBlock !== 'undefined') {
adBlockDetected();
} else {
var importFAB = document.createElement('script');
importFAB.onload = function() {
fuckAdBlock.onDetected(adBlockDetected);
fuckAdBlock.onNotDetected(adBlockNotDetected);
}
importFAB.onerror = function() {
adBlockDetected();
}
importFAB.src = 'https://cdnjs.cloudflare.com/ajax/libs/fuckadblock/3.2.1/fuckadblock.min.js';
document.head.appendChild(importFAB);
}
});
</script>
I found a post similar to mine
link
but when I add fuckAdBlock.check(loop);
it accuses error.
document.addEventListener("DOMContentLoaded", function(){ fuckAdBlock.check(loop); });
I do not know if I wrote it right, because I did not want to use jQuery ....