Rss Feed Like Us on facebook Google Plus

March 4, 2012

Add adsense at top of only post pages in blogger

Adding Adsense ads to the top of only posts pages in Blogger (as seen above) and not on any other page (home page , archives etc.) is bit difficult keeping in view the limitations of the Blogger (blogspot) blog. According to Adsense policies one can only have the three ad units and three link units simultaneously at any webpage. If you add the Adsense code to top of each post then at home page if you are having, lets say, five posts then Adsense cannot be shown at top of each post.

 Also it’s better to have clean home page with recent posts and their summaries and ads only show on top of post at post page. A little trick can solve this issue. Thanks to Page type in Blogger.The posts have the pageType= item. Just follow the steps given below to add the Adsense to top of each post of Blogger and at the same time the ads will not be shown on home page etc.



1. get the Google Adsense ad codes from your Adsense accounts and parsed them so that it can be used in Blogger template. You can use this tool.

2. Go to Blogger account and then go to Design > Edit HTML.( Backup your template as precautionary measure)

3. Check the Expand Widget Templates box and search the following line of code in your template by pressing CTRL + F

<div class='post-body entry-content'>
 
4. Rite After this add the following lines of code. Replace the line (YOUR ADSENSE AD CODE) with parsed Adsense code in step 1.
 
<b:if cond='data:blog.pageType == "item"'>
<div style='float: top;'>
YOUR PARSED ADSENSE AD CODE
</div>
</b:if>

5. Save the template and you are done.

You can define the float property to define the Ads placement. With top property Adsense ads will be shown at top of each post just below the title of post. If you want to merge the Adsense ads at the top left of right of the post just write left or right instead of top.
Most people recommend to have the 300×250 or 336×280 ad unit at the top of the post as its gives better results specially for the visitors who landed one your post via search engines.

© 2011-2016 Techimpulsion All Rights Reserved.


The content is copyrighted to Tech Impulsion and may not be reproduced on other websites.