HackingUniversity - Hacks . Tricks . How-To's

02 December 2016

How to Remove AdSense Ads from Specific Blogger Post

This is question many bloggers ask and even I was concerned about this same question well how we can remove adsense ad code from a specific blogger post. Being on wordpress its a simple process using some plugins we can achieve anything we like but being on blogger its a techy thing and requires you to be little creative. By creative I mean you need to have some tech skills under the jQuery and JavaScript category to get anything according to you.

REMOVE ADSENSE ADS FROM SPECIFIC BLOGGER POSTS

Well today we will be looking at how you can remove or exclude adsense ads to be loaded on specific post that might fall under the violation category in adsense.

Why we have to remove adsense ads from specific blogger post?

This might be another question arising in few readers mind that why the hell someone would lessen there earnings being made from there post, well that due to the policies lead by adsense that we cannot include adsense ad code on any post that might lead to copyright material, even posting some copyright based stuff is illegal and its very important that our ad code should not be present on any of that site or content or any article.

So with the trick mentioned below we can easily remove adsense ads from all those posts and stay safe while making money from other legal content we have posted.

Now this does not mean that you start posting so many illegal content that is not valid, but this should only be used for some articles that do not fall under harsh category but still could have few aspects that could lead to disablement of your adsense account.

Simple Script to Remove or Exclude AdSense Ads from any Specific Blogger Post

So lets get started to see how easily with a simple script can remove or exclude adsense ads from any specific blogger post.

  1. Make sure to enclose every single ad code you have applied in your template with the below code.

    <div id="GoogleAds1">


    <script type="text/javascript"><!--
    google_ad_client = "pub-xxxxxxxxxxxxxx";
    google_ad_host = "pub-xxxxxxxxxxxxxxx";
    /* 300x250 */
    google_ad_slot = "xxxxxxxxxx";
    google_ad_width = 300;
    google_ad_height = 250;
    //-->
    </script>


    </div>

  2. Your code looks something the above, just enclose it with the remove-ads div tag, this is the first step and this should be done to all the ad codes you have added in your template.
  3. After this your main work is done, now its time to select the posts from which you need to remove Google Ads, so select all those posts and then you need to press the Edit Post and then add below code right at the end of the post.

    <script type="text/javascript">
    var Ads1 = document.getElementById('GoogleAds1');
    Ads1.parentNode.removeChild(Ads1);
    </script>

  4. So add the above code and all your adsense ads that fall under the above mentioned DIV ID would remove.
  5. That’s it now save your post or Publish it and enjoy that post without the problem of content that might violate the adsense terms.


This is the best possible I came across to hide or remove adsense ads, I hope this works for you and you can easily stay safe from all that copyrighted content that might be violating adsense terms.