inserting Adsense Code to New Blogger Template
Here’s another way of inserting Adsense Code to New Blogger Template. Since adding Adsense as Page Element is limited to the setup provided by Blogger.com, you need to manually insert Adsense codes in other areas of the template not provided.
Escaping Adsense Code Before Inserting in Blogger Template
To manually insert Adsense code in new Blogger template, you have to escape HTML characters or convert the HTML codes to HTML entities like these: < to <, > to > and ” to ". Without escaping Adsense HTML codes, Adsense will not work properly. Your Adsense code should look like this example of large Google Ad (XXXXXXXXXXXXXXXX is the publisher ID):
&lt;script type="text/javascript"><!–
google_ad_client = "pub-XXXXXXXXXXXXXXXX";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336×280_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "6600CC";
//–></script>
<script type="text/javascript"
src="http://pagead2…/pagead/show_ads.js">
</script>
google_ad_client = "pub-XXXXXXXXXXXXXXXX";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336×280_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "6600CC";
//–></script>
<script type="text/javascript"
src="http://pagead2…/pagead/show_ads.js">
</script>
I have prepared a page to easily escape HTML codes to HTML entities, here(opens in new window). Copy and paste your Adsense code to the box provided and click convert. Then, cut and paste the converted or escaped Adsense codes to your Blogger template. Preview it if displayed properly.
Inserting Adsense Code Before or After Blog Title
Insert the converted Adsense code within <div id=’header-wrapper’></div>, like this:
<div id=’header-wrapper’>
Adsense code here (before Blog title)
<b:section class=’header’ id=’header’ maxwidgets=’1′ showaddelement=’no’>
<b:widget id=’Header1′ locked=’true’ title=’Blog Title (Header)’ type=’Header’/>
</b:section>
<b:widget id=’Header1′ locked=’true’ title=’Blog Title (Header)’ type=’Header’/>
</b:section>
Adsense code here (after Blog title)
</div>
Inserting Adsense Code After Blog Title Before Blog Post
Insert the converted Adsense code within <div id=’main-wrapper’></div>, like this:
<div id=’main-wrapper’>
Adsense code here (before blog post)
<b:section class=’main’ id=’main’ showaddelement=’no’>
<b:widget id=’Blog1′ locked=’true’ title=’Blog Posts’ type=’Blog’/>
</b:section>
<b:widget id=’Blog1′ locked=’true’ title=’Blog Posts’ type=’Blog’/>
</b:section>
Adsense code here (after blog post)
</div>
Inserting Adsense Code Within the Blog Sidebar
Insert the converted Adsense code within <div id=’sidebar-wrapper’></div>, like this:
<div id=’sidebar-wrapper’>
Adsense code here (before Blogger widgets)
<b:section class=’sidebar’ id=’sidebar’ preferred=’yes’>
<b:widget id=’Label1′ locked=’false’ title=’Labels’ type=’Label’/>
<b:widget id=’BlogArchive1′ locked=’false’ title=’Blog Archive’ type=’BlogArchive’/>
</b:section>
<b:widget id=’Label1′ locked=’false’ title=’Labels’ type=’Label’/>
<b:widget id=’BlogArchive1′ locked=’false’ title=’Blog Archive’ type=’BlogArchive’/>
</b:section>
Adsense code here (after Blogger widgets)
</div>
If you want to insert Adsense code between 2 widgets, you have to assign a different sidebar id for each widget affected and add converted Adsense code between them, like this:
<div id=’sidebar-wrapper’>
<b:section class=’sidebar’ id=’sidebar1′ preferred=’yes’>
<b:widget id=’Label1′ locked=’false’ title=’Labels’ type=’Label’/>
</b:section>
<b:widget id=’Label1′ locked=’false’ title=’Labels’ type=’Label’/>
</b:section>
Adsense code here (between 2 Blogger widgets)
<b:section class=’sidebar’ id=’sidebar2′ preferred=’yes’>
<b:widget id=’BlogArchive1′ locked=’false’ title=’Blog Archive’ type=’BlogArchive’/>
</b:section>
<b:widget id=’BlogArchive1′ locked=’false’ title=’Blog Archive’ type=’BlogArchive’/>
</b:section>
</div>
Inserting Adsense Code Within the Blog Footer
Insert the converted Adsense code within <div id=’footer-wrapper’></div>, like this:
<div id=’footer-wrapper’>
Adsense code here (before Blog footer content)
<b:section class=’footer’ id=’footer’>
<b:widget id=’AdSense1′ locked=’false’ title=” type=’AdSense’/>
</b:section>
<b:widget id=’AdSense1′ locked=’false’ title=” type=’AdSense’/>
</b:section>
Adsense code here (after Blog footer content)
</div>
For your info, however, there are questions if this kind of Adsense code modification violates Adsense Policy and Adsense TOS. In my opinion, it is not as this is just a server-side scripting. If you view the HTML source code of your Blogger page where you inserted a converted Adsense Code, you will see an unmodified Adsense code. So, there is no code modification in HTML implementation