fbpx

How to add Adsense Ad Code in Your Blogger Blog Below the Title and at the end of the blogpost?

3 min


181
181 points

Blogger is a great platform offered by google to bloggers but let’s admit it, its no WordPress.

There are no Quick Adsense like plugins in blogger like there are in WordPress and for that reason alone, a lot of bloggers are clueless on How to add Adsense Ad Code in Your Blogger Blog Below the Title and at the end of the blog post?

Let us teach you how in few simple steps.

Step 1.) Go to Templates and click on restore/backup and backup your xml file. It's always advisable to do this whenever you are making any changes to your theme.

Step 2.) Open the XML file that you just downloaded and Find " <div class='post-header'> TAG and Paste your Adsense code below that line as shown 

<div class=’post-header’><div class=’post-header-line-1’/>// if you have some code in your theme, that is placed here. make changes according ///</div><div class=’post-body entry-content’ expr:id=’&quot;post-body-&quot; + data:post.id’><b:if cond=’data:blog.pageType == &quot;item&quot;’><b:if cond=’data:blog.pageType == &quot;item&quot;’>&lt;div style=&quot;display:block;text-align:center;margin:15px auto;&quot;&gt;<— ADD YOUR ADSENSE CODE HERE – STARTING IN POST ——>&lt;/div&gt;</b:if><data:post.body/><b:if cond=’data:blog.pageType == &quot;item&quot;’>&lt;div style=&quot;display:block;text-align:center;margin:15px auto;&quot;&gt;<— ADD YOUR ADSENSE CODE HERE- MIDDLE or Bottom of post ——>&lt;/div&gt;</b:if><b:else/><b:if cond=’data:blog.pageType == &quot;static_page&quot;’><data:post.body/><b:else/><div expr:id=’&quot;p&quot; + data:post.id’><data:post.body/></div>



Now Suppose you do not want to add the adsense add code in the beginning and end of the code but are thinking - How to Add Adsense Ads In the Middle or Anywhere inside Blogger Posts?

Let us show you how, but as always,  Before proceeding, backup your template (go to Template > click on the Backup/restore button)

Step 1.
Go to Template, click on the Edit HTML button, click anywhere inside the code area and search (CTRL + F) for :

<data:post.body/>

Step 2. Replace the <data:post.body/> tag with this code:


<div expr:id='"adsmiddle1" + data:post.id'></div><b:if cond='data:blog.pageType == "item"'><b:if cond='data:blog.pageType != &quot;static_page&quot;'><div style="clear:both; margin:10px 0"><!-- Add Your Adsense Ad code here --></div></b:if></b:if><div expr:id='"adsmiddle2" + data:post.id'><data:post.body/></div><script type="text/javascript">var obj0=document.getElementById("adsmiddle1<data:post.id/>");var obj1=document.getElementById("adsmiddle2<data:post.id/>");var s=obj1.innerHTML;var r=s.search(/x3C!-- adsense --x3E/igm);if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}</script>


Step 3.
Replace
<!-- Add Your Adsense Ad code here --> with your actual Adsense code and save the changes by clicking on the Save template button.

Step 4.
When you create a New Post, add
<!-- adsense --> inside the HTML section wherever you want the Google AdSense ads to appear.


For example:
<!-- adsense --><div>Your blog post content here. Your blog post content here. Your blog post content here. Your blog post content here. Your blog post content here. Your blog post content here. Your blog post content here. Your blog post content here. Your blog post content here. Your blog post content here. </div>




Quick Tip: If you want the ads to show up in center alignment, then align the AdSense code, like this:


<center> <!-- Add here the code of your ad --></center></div>

The ad will appear below the title by default even if you do not add the <!-- adsense --> code in your html.
Have a Question? Comment Below. We are here to help you.

Like it? Share with your friends!

181
181 points
Blogging India
We help Bloggers to Build A Blog, Brand, Internet business And Make Money Online.Contact us for more information or just say Hi.
Choose A Format
Personality quiz
Series of questions that intends to reveal something about the personality
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Poll
Voting to make decisions or determine opinions
Story
Formatted Text with Embeds and Visuals
List
The Classic Internet Listicles
Countdown
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Meme
Upload your own images to make custom memes
Video
Youtube and Vimeo Embeds
Audio
Soundcloud or Mixcloud Embeds
Image
Photo or GIF
Gif
GIF format
Send this to a friend