Wednesday, August 1, 2018
Add Adsense Banner Under Second Paragraph of Your Blog Post
Add Adsense Banner Under Second Paragraph of Your Blog Post
Adsense
Login to your blog Dashboard, click Template ->Edit HTML.
Click on the code area use ctrl+f on windows or cmd+f on Mac PC to open search box.
Click on the arrow pointing to </b>:skin>...</b:skin> on the template code to expand code(see image below)
Search for this code line <data:post.body/>
You might find this code line multiple times, go with the second one, insert the <div id=adsense-target> code before <data:post.body/> and </div> after it.
Now the code will look like this below.
[html]<span style="background-color: #f9eb20;"><div id=adsense-target><data:post.body/></div></span>[/html]
Copy the Adsense code you want to show and use this tool to covert it to Plain text. Just above the line that we just found, add the following HTML and replace the "ADSENSE CODE HERE" text with the converted ad code.
[html]<span style="background-color: #f9eb20;"><b:if cond=data:blog.pageType == "item"><div id=adsense-content style="display:block;text-align: center">ADSENSE CODE HERE</div></b:if></span>[/html]
See image below
How to align Adsense Right or Left
By default the Google Adsense appears at the middle after the first paragraph but if you want to make change text to it (wrap text around it). You can choose one of the option below.
A. For left align
[html]<span style="background-color: #f9eb20;">Align AdSense to the left: change<div id=adsense-content style="display:block;text-align: center">with<div id=adsense-content style="display: inline-block;float: left;margin:15px 15px 15px 0px"></span>[/html]
After modifying it the add will look like the picture below.
B. For right align
[html]<span style="background-color: #f9eb20;">Align AdSense ad to the right of the content: change<div id=adsense-content style="display:block;text-align: center">with<div id=adsense-content style="display:inline-block;float:right;margin:15px 0px 15px
15px"></span>[/html]
Copy and paste the below code after <div id=adsense-target><data:http://ift.tt/2fjH4ZI
[html]<span style="background-color: #f9eb20;"><script type=text/javascript>function insertAfter(addition,target) {var parent = target.parentNode;if (parent.lastChild == target) {parent.appendChild(addition);} else {parent.insertBefore(addition,target.nextSibling);}}var adscont = document.getElementById("adsense-content");var target = document.getElementById("adsense-target");var linebreak = target.getElementsByTagName("br");if (linebreak.length > 0){insertAfter(adscont,linebreak[0]);
}
</script></span>[/html]
Customizing the code above
1. To add the Adsense after the second paragraph change the [0] to [2].
2. To put the Adsense below heading h2 or h3, replace the br in "br" with h2 or h3.
Now click "save" to save Changes
This tricks helps authomaticaly put Adsense banner after first paragraph on a blog post.
Please we need your support, share this post.