Monday, July 20, 2009

Google AdSense ads In the middle of Blogger Post

When you place Google Adsense Ads in the middle of the blog posts you have to be little careful that not to confuse the reader. Google does not stop webmasters or bloggers using Ads in the middle of the post or just after the Title. What Adsense Blog says is...

Ads shouldn't be placed under a title or section heading in a way that implies that the ads are not ads.

Previously we have gone through a simple way to add Google AdSense Ads in the middle of the post just after the title using CSS and DIV tags. If you want to change it a little bit and display the ads after couple of lines of the post you can apply this simple CSS and DIV tag.

First of all back up your blogger template as a good practice and please do not blame me if you did not back up. You can read the previous post to get a idea about Google Ads in the middle in details as we more focus on putting couple of lines before the Google Ads.
After backing up your blogger template enable Google Ads to display after each posts.
Search for post-body entry-content (Google chrome and FireFox 3.5 support searching text inside the text box)
Copy the following code between..post-body entry-content and data:post.body div tags (Third red box in the picture.

<!--Add the lines before the Google Ads-->
<!--Change height 20px base on the number of lines you want to change-->
<div style='background-color: transparent; float: left; width: 1px; height: 50px; overflow: hidden;' />
<div style='clear:both; float:left; margin-right:5px; margin-top: 5px;'>
<!--Ads will display only in Post page not in home page-->
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<b:if cond='data:post.includeAd'>
<data:adEnd/>
<data:adCode/>
<data:adStart/>
</b:if>
</b:if>
</div>


Isn't it simple and you can change the height of first div tag under styles to changes number of lines before the Google AdSense Ads.

If you have any problems or comments you are always welcome to share it with us. We will try to help you as much as we can.

Blog Widget by LinkWithin