web analytics

How to add adsense ad code AFTER the CONTENT in blogger template?

After the content is one of the recommended ad positions I have already mentioned in the post 5 Best Ad Positions to Increase Adsense Revenue. In this post, we will see how we can add adsense ad code after the content of each post and page. We will do this in the blogger template so that we don’t have to do this for each post and page.

How to Add Adsense Ad Code Before the Content:

Login to your blogger account and go to the Template page using the left side menu and then click on the Edit HTML button.

This will bring up the template code editor. Now click on the code editor and press Ctrl+F and search for <data:post.body/>.

PLEASE NOTE: It can be that you have multiple <data:post.body/> in your template. If you do not know which one is the actual one working then please read the following post to find out or simply watch the following video tutorial first.

Okay, so if you have found the actual <data:post.body/> in your template then after that tag write the following
<b:if cond='data:blog.pageType in {&quot;item&quot;,&quot;static_page&quot;}'>
<div id='afterContentAd' style='float: none; margin: 10px 0 10px 0; padding: 0; text-align: center; width: 100%'>
<!-- Your Ad Code Here -->
</div>
</b:if>

Here, you have to replace <!– Your Ad Code Here –> with your adsense ad code.

Remember, this is XML. So you have to escape your ad code for XML. To do this, you can use this XML Escape/Unescape tool. Just copy your ad code and place it in the textarea in the tool and click ESCAPE, then copy the escaped code and paste here at <!– Your Ad Code Here –>

I recommend you to use a responsive ad in this place, as those have performed well for me.

Also, as you can see, I have placed a wrapper around the ad code with ID #afterContentAd with style to float none and 10px margin at top & bottom.

If you want to have an square ad that aligns to right then change float to right and margin to ‘0 0 10px 10px’ and remove width 100%

If you want to have an square ad that aligns to left then change float to left and margin to ‘0 10px 10px 0’ and remove width 100%

You can optionally use height and width with the wrapper div too.

As you are using ads in content, it is highly recommend that you blend the style of the ad with the style of your content.

Thank you. Take a moment to share 🙏