A little extra hint for the Adsense code, if you're using responsive ad blocks you could see that the first DIV with ads is not showing any but the second one on the page is. This is because the adsense script is trying to fill the block before the page is loaded. To fix this:
change:
Code: Select all
(adsbygoogle = window.adsbygoogle || []).push({});
to:
Code: Select all
window.setTimeout(function(){
(adsbygoogle = window.adsbygoogle || []).push({});
}, 200);
Use case:
Add a warning when adblockers are disabling ads on your site. This is roughly coded, please change as you want.
1) overall_header_content_before.html
Code: Select all
<!-- Adblock warning message -->
<div id="pleasedisableadb" class="post adbwarning"><h3>Please disable your adblocker on this website!<br />The website costs are covered by using ads that are non-intrusive. Please whitelist this domain in your adblocker software or plugin. Thank you.</h3><h3>Schakel alstublieft de adblocker uit!<br />De kosten van het hosten van de website worden betaald met advertentie-inkomsten. Voeg alstublieft een uitzondering toe voor dit domein in de software of plugin.</h3></div>
2) overall_header_stylesheets_after.html
Code: Select all
<style>
div.adbwarning
{
background-color: #ffeeee;
}
</style>
3) overall_footer_after.html
Code: Select all
<!-- Adblockdetect -->
<div id="bottomAd" style="font-size: 2px; style="display: none;"> </div>
<script>
$(document).ready( function() {
window.setTimeout( function() {
var bottomad = $('#bottomAd');
if (bottomad.length == 1) {
if (bottomad.height() == 0) {
//Ads are being blocked
$("#pleasedisableadb").css( "display", "block" );
$("#pleasedisableadb").show;
//This line will also fill the empty class adsense DIVs with the warning in addition to the warning at the top of the page.
$(".adsense").html('<div class="post adbwarning"><h3>Please disable your adblocker on this website!<br />The website costs are covered by using ads that are non-intrusive. Please whitelist this domain in your adblocker software or plugin. Thank you.</h3><h3>Schakel alstublieft de adblocker uit!<br />De kosten van het hosten van de website worden betaald met advertentie-inkomsten. Voeg alstublieft een uitzondering toe voor dit domein in de software or plugin.</h3></div>');
} else {
//Ads are not blocked
$("#pleasedisableadb").css( "display", "none" );
$("#pleasedisableadb").html("");
}
}
}, 100);
});
</script>
The system relies on the fact that the most popular adblocker (adblock plus) will always block a div with the id bottomAd. The script will check, after a timeout, for the block being present. If not than enable and show the DIV at the top of the page with the predefined text. Additionally fill the now empty DIVs with class adsense also with the warning text. If ads are not being blocked, make sure the top DIV is disabled, and deleted the text inside it just to be sure.