Tags

,

As a blogger, we try to provide unique and quality content. At same time, we also try to make some money from it. The first choice is AdSense, as it does pay well in all ads network. 
As AdSense only allows 3 standard ad units and 3 link units in one page, one way to try to make more money is to always show maximal allowed ads.

We are writing programming related posts at lifelongprogrammer.blogspot.com.
We show 3 standard ad units: one at one at header,one inside the post body, and one at left-sidebar,
It’s easy: just add 2 Adsense widget or HTML/JavaScript widget in Layout setting, and add the ad in appropriate place in the post.

But what about the homepage, archive page, label page? 
What We Got
Adsense shows at most 3 standard ad units in order of the ads in the page. In blogspot, the order is like below: center blog post, left side bar(if any), right side bar(if any).

<div class="columns-inner">
 <div class="column-center-outer"/>
 <div class="column-left-outer"/>
 <div class="column-right-outer"/>
</div>

Adsense will always fill the first ad at header, for the remaining 2 ads, Adsense fill 2 ads in the first 2 posts, and leave blank area in left side bar.

//<![CDATA[
if(showAdsense){
document.write("(adsbygoogle = window.adsbygoogle || []).push({});”)
} else {
if (window.CHITIKA === undefined) {
window.CHITIKA = { ‘units’ : [] };
};
var unit = {
‘publisher’ : “jefferyyuan”,
‘width’ : 728,
‘height’ : 90,
‘type’ : “mpu”,
‘sid’ : “Chitika Default”,
‘color_site_link’ : “FFFFFF”,
‘color_title’ : “FFFFFF”,
‘color_border’ : “FFFFFF”,
‘color_text’ : “4E2800”,
‘color_bg’ : “F7873D”
};
var placement_id = window.CHITIKA.units.length;
window.CHITIKA.units.push(unit);
document.write(“

“);
var s = document.createElement(‘script’);
s.type = ‘text/javascript’;
s.src = ‘http://scripts.chitika.net/getads.js&#8217;;
try {
document.getElementsByTagName(‘head’)[0].appendChild(s);
} catch(e) {
document.write(s.outerHTML);
}
}
//]]>

This is not we want:
1. We want to show ads “above the fold” – where user can read without scrolling. 
Ads “above the fold” will have a better click-through rate than ads below the fold.
Place ads near where visitors eyeballs naturally go to in order to get the best CTR (top left, near titles, near site navigation, etc).
Read more at 5 Simple Adsense Layout Examples for Increasing Click Through Rates
2. Blank space in left side bar makes blog look ugly and unprofessional.
What We Want
For homepage, archive page, label page, we want Adsense always shows the 3 standard ad units above the folder: the ad at header, the ad in the first post, the ad in left side bar.
Also for other posts, in the ad slot, I want to display alternative da, for example chitika.

Also in the first post, we want to display one link ad unit below title, one link ad at the end of post.

With the following change, we see immediate change in Adsense revenue.  
Solution
Edit Template
We edit the template: define one variable firstAds, it’s true by default, at the end of post <data:post.body/>, change its value to false.

<script src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'/>
<!-- define firstAds = true -->
<script>var firstAds = true;</script>
</head>

<div class='post-header'>
 <div class='post-header-line-1'/>
 <script>
 <!-- display one link ad below title if it's first post -->
 // <![CDATA[
 if(firstAds){
 document.write("<br><ins class='adsbygoogle' ></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script>");
 }
 // ]]>
 </script>
</div>
<div class='post-body entry-content' expr:id='"post-body-" + data:post.id' itemprop='articleBody'>
 <data:post.body/>
 <!-- display one link ad after the first post, and set firstAds to false -->
 <script>
 // <![CDATA[
 if(firstAds){
 document.write("<br><ins class='adsbygoogle' ></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script>");
 firstAds=false; // change its value to false
 }
 // ]]>
 </script>
Use firstAds to Conditionally Display Ad in Post
When add ad in post, we will use the firstAds variable: if it’s true(means this is the first post in homepage, archive page or label page), display Adsense ad, otherwise display alternative ads.

<script>
//<![CDATA[ 
if(firstAds){
document.write("<ins class='adsbygoogle' ...></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script>")
}  else {
 // javasctipt to show alternative ads.
}
//]]>  
</script>

Resources
How To Insert Adsense Ads In Blogger Post
7 Blogger Page Types: Analysis, Code Snippets, Data Matrix
5 Simple Adsense Layout Examples for Increasing Click Through Rates

via Blogger http://lifelongprogrammer.blogspot.com/2013/11/display-adsense-efficiently-and-conditionally-show-alternative-ads.html

Advertisements