Google AdSense and AdBlock

I have Google AdSense ads on my site, and AdBLock blocks them, which is fine. When they are blocked, I would like to display alternate content. The problem is that when the ads are blocked, there are two things that can happen:

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

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

Option 1 is perfect because it allows me to check the height of the container, or for tags that AdSense renders, and show my alternate content if the height is 0, or if a specific AdSense tag doesn't exist. However, when option 2 occurs, I don't know what I can do to display my alternate content, and the AdSense ads take up their required height and width, but don't display any content, making my site look broken.

Has anyone else had any experience with this issue? My site is in .net 4.0 and I've only tested AdBlock in Chrome v12 so far.


Sounds like you have option 1 covered (if height is 0, ajax in your own ads).

For option 2, isn't that add area blank or hidden?

So maybe something like this would work:

var adNode  = $('#Google_Ad_Container');

if ( adNode.is (':hidden')  ||  ! /S/.test (adNode.text () ) )
{
    // Ajax in your ads here...
}

Set a min-height/width and have the background of the box be an image / alt content (I assume it will be a message saying please whitelist us)

Set the image to no-repeat and background color to match the background of the image.

No matter the size of the box now, you'll have your message there.

I hope I made sense.


我在我的网站上测试了这个脚本:http://www.amzaz.info和http://www.geojamal.com它的工作非常好..它是一个示例脚本,你可以做///使用这个:

<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>
链接地址: http://www.djcxy.com/p/53730.html

上一篇: WPF ClickOnce和部分信任问题

下一篇: Google AdSense和AdBlock