Skip to main content

How to Display Just One Google Adsense Ad on Blogger MainPage

DI regular Kaileena of Celeb Gossips writes in - "I want to place an Adsense ad unit on my blogspot blog after the first post only like you have done."

Before we get to the Blogger Template code, let's look at the requirement in detail.

As most Blogspot users know already that with Blogger, if you add an Adsense ad unit after the first blog post, the ad unit will appear after the next two posts as well because the template mechanism replicates whatever code it finds inside the <Blogger> tags.

[Though visitors see only three ad units as Google Adsense technology automatically blocks serving more than three ads on a single webpage.]

To prevent this and ensure that only one Adsense Ad unit appears between your first and second blog posts on the mainpage (like in the above screenshot), you will have to slightly change the method of writing Adsense code via javascript.

Step 1: Add the following javascript snippet inside the <head> tag.

<script type="text/javascript">googleadcount=1;</script>

Step 2: Copy your Adsense code generated from the Adsense control panel and append it your Blogger template as shown below:

<div class="post-body">
<script type="text/javascript"><!--
google_ad_client = "pub-xxx"
google_ad_width = 468;google_ad_height = 60;

<script type="text/javascript">

if (googleadcount==1) {
  document.write('<script type="text\/javascript"


The magical role is played by the variable googleadcount that we defined in Step 1. If the value of this variable is more than 1 (meaning an ad has already been displayed), it would skip displaying subsequent ads on your Blogger MainPage or ArchivePage.

Important Note: Since modifying Adsense generated code is against Adsense TOS, I strongly suggest that you obtain permission from Google before implementing the above solution.

Related Adsense Case Studies: Scott Hanselman Blog, Rashmi Bansal