Monday, April 28, 2008

How to add ads inside posts without altering adsense codes

I've been longing to implement techniques that show ads inside blog post , but refrained from doing this because all the suggestions I had found involved changing the adsense code , even if it was just a bit and that was enough reason for me to think that I'd be violating their TOA , but the doubting tom finally took a break!

I learned the codes that let you add ads inside blog posts in the new blogger to make them more relevant without even touching the adsense codes from a kind techie friend. We will be using the if : else conditional codes to make this work. In the final outcome , you can expect ads to show in between the title and post on item pages , i.e pages other than the main page.

Login to your blogger account and on the dashboard click the "layout" button against the corresponding blog.On the layout page , click on the edit button on "blog posts" block.Check the box at the bottom that says "show ads between posts". Now choose the format and the colors for the ads that you think will work best for your blog in the "configure inline ads" or you can simply choose the blend template option for the colors. Save the changes you just made and revert back to the layout page.

On the layout page, click on the html button and download the template and save it before you start making any s to it. I had forgotten to do this and I was saved only because I tried it out on one of my lucky days.:) Check the expand widgets box at the top left. Search for this code in the html :

Once you have found it , replace it with this code:
What we did was to simply wrap the original code within a conditional if else code.
Now you will need to find this code in the html

Add the exact code shown below just before it for ads to appear before the post or just after it for ads to appear after the post.You can also add the code both before and after the code as I have done.
Once you feel sure that you have made the appropriate changes , save the template. That's it! Now when you visit any of your item pages , your ads should appear between the blog title and blog post and you will not have to touch the adsense script to achieve this result. If you are tempted to experiment with different ad formats , you can do so directly from your layout page without having to modify the html any further.






0 comments: