Wednesday, January 03, 2007

Adsense inside the article/post in new blogger(beta).

With due credit to Loui$$ who maintains the blogginsecret.blogspot.com here am providing you with the hack he has mentioned at his blog to put Google Adsense right at the beginning of your article or within the post in Blogger Beta or the newblogger. Also see some additional notes from me.

Ok, let us have look at the method and how I did it:

1. Login to your Adsense account and get the code for the Adsense lay out you prefer and copy and paste it into a note pad.

Hope most of you know how to get the code. Google adsense account>adsense for content>Ad Unit>text ads.

2. Next on the notepad you will see the code in the following form:
<script type="text/javascript"><!--
your ads code
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Now replace the <!-- and //--> as &lt;!-- and //--&gt;

3.Login to your new blogger and go to Layout > Edit HTML > and copy and paste the template into your notepad.

4. In the notepad in which you have saved the template search within the notepad (using Cntrl + F ) for the following term: post-header-line-1

This will enable you to find div class="post-header-line-1" which is just below the data:post.title

5.Now copy the whole Adsense code that you got from Google Adsense accout that was changed by replacing the <!-- and //--> as &lt;!-- and //--&gt; as mentioned in step 2 and paste it just under the "post-header-line-1"

6.Replace the template in your blogger with this changed template by deleting the template in your blogger template box andthen copying and pasting the template from your notepad into the blogger template box. You are done.

Additional notes:

1.Before you copy and paste the template check the "Expand widget templates" and then copy and paste the template on yournotepad. Only then you will see the div class="post-header-line-1"

2.Back up your templates before changing it.

3. Google allows only 3 Adsense layouts and one link unit. So if you already have some, make sure before you add more Adsense within your post, those ones are deleted. Google ensures that only 3 different Adsense layouts are shown even if you place more. But it is better to be on the safer side by ensuring that you have put in only 3 Adsense layouts and one link unit.

4. If you already have placed Adsense in your blogger using the Add HTML page element save that in your notepad before taking it off as this will enable you to put it back easily if you want to experiment with the Adsense layouts instead of going back to your Adsense account each time to generate codes.

5. Originally Loui$$ had mentioned about just deleting the tags within the google Adsense code. But later it was changed to replacing the tags as mentioned in step 2 as this would ensure that the Google TOS is not violated. This particular idea was suggested by bloggerdigest.

How to put Adsense at the end of an article/post:

The above mentioned method allows people to put the Adsense Ads at the beginning of an article in the new blogger (Prev. Beta). To put an Adsense Ad at the end of an article or a post use the same method mentioned above, the only difference being this time the Adsense code (just like the hack mentioned above) has to be put under the class= 'post-footer-line post-footer-line-1'

How to wrap Adsense around posts:

Google