Skip to main content

How to Add Adsense Ads In the Middle or Anywhere inside Blogger Posts

In a previous post we saw how and where we can place Adsense ads on our blog; however, these methods would only work when we place the ads on predetermined and fixed locations. For posts area, the most common places are below the title, at the beginning of the post or at the end of the post.

But what if we want to display an AdSense ad in the middle of a post?
We can manipulate the location of the ads to be displayed by adding a script inside the template and using a tag inside our post to where we want the AdSense ad to appear. Once added, we can place the ads anywhere, be it between paragraphs or in the middle of the content etc.
Manually inserting Adsense ads in the middle of posts in Blogger is pretty simple, just follow these steps below:
Before proceeding, it is recommended do backup your template (go toTemplate > click on the Backup/restore button)
Step 1. First thing we need to do is to "parse" the AdSense code, in other words, convert it to plain text. Then go to Template, click on the Edit HTML button, click anywhere inside the code area and look for this tag (CTRL + F):


<data:post.body/>
Note: you may find it several times, but we need to stop at the second one or if you can't see any changes, test the third one
Screenshot
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 here the code of your ad -->
</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. Put the converted Adsense code to where you see the <!-- Add here the code of your ad --> annotation, then save the changes by clicking on the Save template button.
Note: For centering ads, add the center tag before and after the AdSense code, like this:
<div style="clear:both; margin:10px 0">
<center>
<!-- Add here the code of your ad -->
</center>
</div>
Step 4. When you create a New Post, add this tag inside the HTML section to where you want the Google AdSense ads to appear:
<!-- adsense -->
For example:
<div>This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text.</div>
<!-- adsense --><div>This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text.</div>

Screenshot
Note: If you don't add the label to bring up the ad, then the ad will appear below the title by default.
And you don't have to worry about violating the Google's Terms of Service because applying this method we are not changing the structure of the ad

(Author can be reached at By- Sonu Mehla Mobile- 8285910007 E-Mail- sonuandfirm@gmail.com)

Popular posts from this blog

Youtube Creative Commons (CC) क्या होते हैं और इनका इस्तेमाल कैसे करें

क्रिएटिव कॉमन्स (Creative Commons (CC) | Youtube Creative Common Video Kya Hote Hain - Janiye Hindi Me | Creative Common Videos का इस्तेमाल कैसे करें Rohit Maan Posted by Rohit Maan 10/04/2020 Creative Commons On youtube in hindi guide guruji दोस्तों सामान्यतः यूट्यूब पर जो सामग्री होती है, उसका इस्तेमाल कोई भी दूसरा व्यक्ति फिर से नहीं कर सकता है ओर ऐसा करना यूट्यूब की पॉलिसी के खिलाफ होता है और अगर आप यूट्यूब की किसी भी सामग्री को कॉपी करके फिर से यूट्यूब पर डालते हैं तो उसका ओरिजिनल मालिक आपके खिलाफ कॉपीराइट स्ट्राइक लगा सकता है और इसके चलते Youtube आपके चैनल को ब्लॉक कर सकता है। लेकिन यूट्यूब पर कुछ ऐसी सामग्री भी उपलब्ध हैं, जिनको आप इस्तेमाल कर सकते हैं और आपके खिलाफ कोई भी कॉपीराइट क्लेम नहीं आएगा। youtube की ऐसी सामग्री को Creative Commons सामग्री कहते हैं। जी हाँ दोस्तों, यूट्यूब पर उपलब्ध Creative Common वीडियो या सामग्री को आप डाउनलोड करके फिर से अपने चैनल पर कैसे भी इस्तेमाल कर सकते हैं और आपके खिलाफ ऐसा करने से कोई भी कॉपीराइट स्ट्राइक भी नहीं आएगा। Youtube पर उपलब्ध Creat...

Details overview of Busy Software

Download the latest versions of Busy Desktop, Busy Mobile App, Busy Agent, Busy BNS, Migration of Data from Tally to Busy, Formats for GST Data Upload, Sample Data and other related resources to help you get started with and usage of Busy Accounting Software. BUSY 21 Release 10.0 (Latest Release) of Busy Accounting Software – India’s No.1 GST Accounting Software file_download Download Busy 21 Release Notes Statutory Updates Archives BUSY 21 (Rel 9.7) file_download BUSY 21 (Rel 9.6) file_download BUSY 21 (Rel 9.5) file_download BUSY 21 (Rel 9.4) file_download BUSY Online Client Latest Release – Most Secure Online Accounting On Cloud file_download Download Busy Online Client BUSY Mobile App Download the latest version of BUSY Mobile App, which gives Busy Desktop Software Customers access to 100+ reports related to Sales, Purchases, Receivables, Payables, Stock and much more. The app also allows you to create and share receipts, invoices, orders and quotations with ease   BUSY BNS Dow...

9 Smart Ways To Boost Reader Engagement On Your Blog

Are you struggling to get your readers to engage with your blog? When I started blogging, I struggled too. But then I found that people who have an engaged audience on their blogs have this one thing in common: Their content is interesting. “How can I make my content interesting?” Well, that’s what I will be answering in this guide. I know how it feels when your readers read all your posts but don’t take the time to comment or share. I know it hurts. Reader engagement is the key to building a massive community of fans. Your readers engage with your blog in a lot of different ways. This engagement could take place in any of the following forms: Commenting on your blog posts Sharing your blog posts Navigating to another blog post Subscribing to your newsletters Or simply taking some action Reader engagement is also a search engine ranking factor. Google uses the bounce rate of your website to measure Reader Engagement. Bounce Rate is simply ...