Google AdSense and AdBlock

I have Google AdSense ads on my site and AdBlock blocks them, which is normal. When they are blocked, I would like to display alternative content. The problem is that when an ad is blocked, two things can happen:

1) The ad is completely blocked by AdBlock, the height and width of the AdSense ad are 0, and most of the AdSense code is not generated.

2) The content of AdSense ads is blocked, but the height and width are set, and the AdSense code is generated.

Option 1 is ideal because it allows me to check the height of the container or tags that AdSense displays and display my alternate content if the height is 0 or if a specific AdSense tag does not exist. However, when option 2 appears, I donโ€™t know what I can do to display my alternative content, and the AdSense ads occupy the height and width they need, but they donโ€™t display the content, which makes my site look corrupted.

Has anyone else had experience with this problem? My site is in.net 4.0, and so far I have only tested AdBlock in Chrome v12.

+7
source share
3 answers

It looks like you have option 1 (if the height is 0, ajax in your own ads).

For option 2 does not mean that the added area is empty or hidden?

Perhaps something like this will work:

var adNode = $('#Google_Ad_Container'); if ( adNode.is (':hidden') || ! /\S/.test (adNode.text () ) ) { // Ajax in your ads here... } 
+2
source

Set the minimum height / width and set the background as the content of the image / alt (I assume this will be a message indicating, please, to the white list)

Set the image without repeating and the background color to match the background of the image.

Regardless of the size of the window, you will receive your message there.

I hope I have a point.

+2
source

I tested this script on my sites: http://www.amzaz.info and http://www.geojamal.com it works very well .. this is a sample script, you can do it /// use this:

 <script type="text/javascript" src="http://erikswan.net/abp/advertisement.js"></script> <script type="text/javascript"> if (document.getElementById("tester") != undefined) { } else { alert('Warning!! Turn off AdBlock to continue'); window.location.reload(); } </script> <style> #tester { display:none; } </style> 
0
source

All Articles