How To Block Adsense Ads On Single Blogger Post | DiGiztal

Last Updated On:March 28, 2012

How To Block Adsense Ads On Single Blogger Post


Here is a tip on how to block or hide Adsense ads on a single Blogger blog post.

You need to do this, probably because you have received a warning message from Google Adsense.

It could be, one of your blog posts have violated its program policies.

How To Block Adsense Ads On Single Blogger Post


how to block Adsense ads from single Blogger post

There are two things which you have to do:

First you have to add div to Adsense code.

Second, you need to add a special JavaScripts at the end of any of the blog post which you do not want to show any Google Adsense ad.

IMPORTANT: Before you do any changes to  your Blogger template, always backup of your Blogger template.

In case you screw up, you can always revert back to your present template.

How To Hide Or Exclude ONE Adsense Unit

1. First, you have to put <div id="AdsenseAds1"> and <div> between your Adsense code, as illustrated below:

<div id="AdsenseAds1">
<script type="text/javascript">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxxxxxxxxx";
/* 160x600, created 9/20/11 */
google_ad_slot = "xxxxxxxxxx";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
2. Now add this JavaScript at the end of the post which you don't want it to have the Adsense ad.

<script type="text/javascript">
var Ads1 = document.getElementById('AdsenseAds1');
Ads1.parentNode.removeChild(Ads1);
</script>
More Than One Adsense Unit

For example, if you have THREE Adsense ad units on your page, then this is how it is done.

1. Similar to the above example, you have to  add div tags between each ad unit.

<div id="AdsenseAds1">
Adsense code for ad unit 1
</div>

<div id="AdsenseAds2">
Adsense code for ad unit 2
</div>

<div id="AdsenseAds3">
Adsense code for ad unit 3
</div>
2. Again you need to add JavaScript at the end of each post which you do not want to show Adense ads.

3. This is what you need to add at the end of your post:

<script type="text/javascript">
var Ads1 = document.getElementByI('AdsenseAds1');
var Ads2 = document.getElementById('AdsenseAds2');
var Ads3 = document.getElementById('AdsenseAds3');

Ads1.parentNode.removeChild(Ads1);
Ads2.parentNode.removeChild(Ads2);
Ads3.parentNode.removeChild(Ads3);
That's how to block Adsense ads on single Blogger blog post.

Written by: Kher Cheng Guan