Include Adsense code directly on your Blog post at Blogger

If you have been blogging for a while then you should have used Google Adsense and like all other serious blogger you should be aware of the placement of Google Ads on your blog. Now it is true that placing the ads directly inside the post will always increase the chances of clicks. Unfortunately in blogger we have a limitation to that! Also even if we put the adsense code directly on the post while using the default editor then also maximum chances are that ads wont show up!

So today we going to discuss how to place Google ad codes directly within your blog post without actually changing the code given by Google, thereby not violating any Google Adsense TOS. Read below to know how…

The Must do trick: Disable Conversion of line break on blogger:

We have previously seen that Blogger editor is able to take scripts directly on it from the “Edit HTML” mode. So the question arises

why we are not able to see ads if we place the adsense code directly on our blog post?

The answer is here:

The original code by Google is something like this

<script type="text/javascript"><!--

google_ad_client = "pub-XXXXXXXXXXXXXX";

/* My-Blog, Top Post banner 468x60, created 6/14/09 */

google_ad_slot = "XXXXXXXX";

google_ad_width = 468;

google_ad_height = 60;

//-->

</script>

<script type="text/javascript"

src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script>

We go to the “Edit HTML” mode and paste it on our post and publish it just as shown below…How we add the code

But we don’t actually see the ads appearing on the Post! Reason? Well by default Blogger is set to convert line breaks into the <br /> HTML tag. So when we publish the post, it gets converted into the following code

<script type="text/javascript"><!--

<br />

google_ad_client = "pub-XXXXXXXXX";

<br />

/* My-Blog, Top Post banner 468x60, created 6/14/09 */

<br />

google_ad_slot = "5211689729";

<br />

google_ad_width = 468;

<br />

google_ad_height = 60;

<br />

//-->

<br />

</script>

<br />

<script type="text/javascript"

src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

<br />

</script>

thereby making the whole code messy and in-effective [Note the red colored <br /> tag which is causing this]

So how to fix this thing?

Don’t worry! It wont take more than a minute. We just need to stop blogger from converting line breaks. Just follow the steps below:

  • Go to Blogger Dashboard > Settings > FormattingGo to Formatting
  • Now scroll down until you see the “Convert Line Breaks” and set the value to “No” [Just as shown on the image below. Disable line break
  • Hit on “Save Settings” and you are all done.

Now you can place ads directly on your blog post through the “Edit HTML” mode as shown above.

Using live writer for better formatting:

After making this trick you should notice that the line breaks are not getting converted in to the way it should and therefore you are not able to format you posts correctly. Remember we have modified blogger to do this right? So what to do now?

The answer is Use Windows Live writer.

With this tool you can format your blog post in rich HTML within a user friendly word-processing environment! You can place you ad codes directly from the “Source” mode or can also use the “Adsense Coder” plug-in to put ads within your post! All these things are explained well in the previous post which you can find here

Well now you should be able to add Google Adsense code on your blog post! If you face any problem on this or want to share any better idea then feel free to do so through your comments…

1 Comment

Comments are closed.