Earn Money On Facebook, Twitter, Instagram Join Now!

Add Google AdSense Ads Between Blogger Posts

LinkNep

 How To Place Google AdSense Ads Between Blogger Posts



I've seen many people ask one question and it seems to be quite an unresolved one. Since I have started adding AdSense ads in the middle of my advertisements, a few people have asked me how they can do the same, but I thought that instead of answering this same question to every individual, I could easily write a post about it for everyone to read.

First of all, let me tell you what is AdSense and how this will work. Firstly, this tutorial is only for bloggers using the Google Blogspot host, so unless you are working on that, this will not work. 

Next, let me tell you that AdSense is also powered by Google and it is an Ad Network that can help bloggers earn money. So, you can add advertisements anywhere on your blog, but for them to appear in the blog posts, it gets a bit harder. You should do this if you have long blog posts and want to generate more income.


Things Needed

So, in case you want to add some AdSense ads in the middle of your posts, you are going to need a few things -
  • An approved AdSense account for your blog
  • Administrator's approval
  • Posts to apply this on.
  • Basic HTML editing skills

How to Do This

To accomplish this task, you need to follow some steps after making sure you meet all the basic requirements

Read: How to Get more Page and Site Views

1. Just to take precaution in case you mess up, head over to the Template section, and take a backup of your Template and store it somewhere safe on your computer.


Taking Backup


2. Now that you have a backup, go to Google AdSense and copy any Ad Code that suits the criteria (desired shape and size) for adding them in the middle of posts.

3. Once you have selected the AdSense code, you need to parse it so that it is XML recognizable which is required in this task. To do this, you can use this tool.

4. Next, head on over to the Edit HTML section of the Template Editor. Search for this code snippet-

<data:post.body/>

5. You might find multiple instances of this, so you have to stop at the second one. If by the end it doesn't work, then try using the third one.


template HTML editor


6. Replace the snippet 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"><center>
<!-- Add here the code of your ad --></center>
</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>

 

7. Now, replace <!-- Add here the code of your ad --> with the parsed ad code you generated in step 3.

8. You can also replace <center> with a different tag to decide the alignment you want for the ads in your post.

9. Save the changes to your template.

Now, after completing all of these steps, you have done the main important thing. What you can do now is check any of your posts, and what we expect you to see is that all of your in-post ads would be at the very beginning of the posts. Unless you want to keep this as-is, you will need to continue further with the tutorial.

Read: How to make Money with Mailchimp Newsletter Subscriptions

How to Get the Ads in the Middle of the Posts

Whenever you would write a post or to add the advertisements in the middle of an already existing post, you would need to follow these easy steps every time.

1. Locate the place in a post where you want to add the ad in the HTML post editor mode.

2. At the located place, enter this snippet for the ad to appear.

<!-- adsense -->

 

3. Once the post is done, click Save or Publish or Update.

Now, you can check on the post you have applied these 3 steps on and you will e able to find the ad wherever you placed it. So, basically, if you want the ads to be in the middle, you will have to decide its location and do it manually.


Read: Bounce Rate - What You Need to Know (Infographic)


I hope that you were able to complete this task and are also able to see the results. Share with us in the comments section, about how this worked out for you and also write down any problems you are facing. Bye for now! Stay Tuned!

Post a Comment

BUY NOW

How To Get To The Top of Google: The Plain English Guide to SEO (Digital Marketing by Exposure Ninja)
BUY NOW

Search Engine Optimization All-in-One For Dummies (For Dummies (Business & Personal Finance))
BUY NOW

3 Months to No.1: The "No-Nonsense" SEO Playbook for Getting Your Website Found on Google
banner
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.