Friday, 8 July 2016

How to display Adsense code to Left / Right side In a Blog Post

Display API     04:08     No comments

Want to know which part of your site or blog will bring you more profit. Add AdSense messaging inside and then check out the popular Google AdSense heat map. Recent studies, however, showed that the first paragraph after placing AdSense site or blog is one of the best AdSense placement. Unfortunately, the default Blogger platform offered by Google- does not allow the installation after the first paragraph: But since it has become the most profitable sectors, many webmasters try to use the best AdSense placement. How can you not enjoy the same level of profit.


To solve the problem, we just move the ads to be displayed in places, adding JavaScript and DIVs. In the following scenario, you can easily select a paragraph or heading, and then you want to inject a statement. This way, you will not have to manually change each post


Show after ads to AdSense, when the first paragraph in Blogger


1. Log into your Blogger account,


 select your own blog, and click "Template" on the left side. Open the Template Editor using the "Edit HTML" button. When the editor opens, click anywhere inside the code of the area and press CTRL + F keys  on your keyboard to open the editor's search box: Search the following line.

<data:post.body/>

2. Add the following DIVs, before and after red, like this.


<div id='adsense-target'><data:post.body/></div>


3. Copy the AdSense code that you want to show 


Use this tool to convert it to plain text. Just above the line that we just found, add the following HTML and replace «AdSense code here" text converted ad code

Select the code below

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div id='adsense-content' style="display:block;text-align: center">ADSENSE CODE HERE</div></b:if>


4. Align the left or right AdSense



By default, Google AdSense ad units will appear immediately after the middle of the first paragraph. If you are unhappy with the results and want to wrap text around the ad, you can choose one of the options below.

a) Align the AdSense ad to the left  :  div id='adsense-content' style="display:block;text-align: center" to the with code below

<div id='adsense-content' style="display: inline-block;float: left;margin:15px 15px 15px 0px">

After Changing the ad will display something like this


b) Align the AdSense ad to the right of content change   div id='adsense-content' style="display:block;text-align: center to the with code below

<div id='adsense-content' style="display:inline-block;float:right;margin:15px 0px 15px 15px">

5. Finally, add this script immediately after the

/*
---***************************** 
How to display Adsense code to Left / Right side In  a Blog Post By http://1lytebyte.blogspot.com/
---*****************************/
<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(&quot;adsense-content&quot;);
var target = document.getElementById(&quot;adsense-target&quot;);
var linebreak = target.getElementsByTagName(&quot;br&quot;);
if (linebreak.length &gt; 0){
insertAfter(adscont,linebreak[0]);
}
</script>
 6. Finally Save the templates. you are done :-)

Imortant Note:


- To insert the adsense code after the second paragraph, change "0" from the line in red with "2".

- If you want to put AdSense just below the heading h2 or heading h3 of a post, replace 
from &quot;br&quot; with h2 or h3.

, , ,

0 comments :

Lyte Byte Tech News

Site Archive

Recommended

Company

Legal Stuff

FAQ's

Blogroll

Subscribe to Newsletter

We'll never share your Email address.
© 2015 Lyte Byte Tech News | Distributed By My Blogger Themes | Designed By Bloggertheme9