Welcome to WebmasterWorld Guest from 18.232.171.18

Forum Moderators: martinibuster

How to do passbacks now?

     
5:05 am on Aug 8, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month

joined:Mar 15, 2013
posts: 1148
votes: 116


I used to have my ad units set to passback to my own script when there wasn't an advertiser, but now I don't see it. I have the Ad Balancer set to 99/62, but it looks like they set up the Ad Balance but then took away my option to sell those $0 spots!

Or am I overlooking something somewhere?
2:08 pm on Aug 8, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1193
votes: 280


It was announced some times ago, that Adsense was in process of "simplifying" things : [webmasterworld.com...]

I believe that the removal of the backup ads is to impact other ads and affiliates networks :).

A trick, which is not that simple to set up, is to check the height of the ad slot, once all is done loading. Like that you can know if its collapsed or not. If collapsed, you can insert another code.
6:49 am on Aug 9, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month

joined:Mar 15, 2013
posts: 1148
votes: 116


Sneaky! Sorta defeats the purpose of the Ad Balancer altogether, doesn't it? Sure, I can stop showing the Google ads that have no value... but I can't (easily) post anything else there, either 3:-)

I guess the easiest way to set up what you described (using pure Javascript) would be:

<div id="adsense_area">
// Adsense code here
</div>

// blah blah blah

<script>
var alternate_code = blah blah blah;

var interval = setInterval(function() {
if (document.readyState === 'complete') {
clearInterval(interval);

if (document.getElementById('adsense_area').clientHeight == 0)
document.getElementById('adsense_area').innerHTML = alternate_code;
}
}, 500);

</script>
</body>
</html>
10:34 am on Aug 11, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Nov 13, 2016
posts:1193
votes: 280


Sorta defeats the purpose of the Ad Balancer altogether, doesn't it?

Yes :)

if (document.getElementById('adsense_area').clientHeight == 0)

I would do
if (document.getElementById('adsense_area').clientHeight < 32)

Because, under some conditions, the div's height might not be zero. So, in my opinion, this is safer to test for height smaller than 32 pixels.

I am not fan of timers. I prefer to use event listeners.
2:36 am on Aug 12, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month

joined:Mar 15, 2013
posts: 1148
votes: 116


I'm not as well versed with event listeners... like this?


var alternate_code = blah blah blah;

document.addEventListener('DOMContentLoaded', (event) => {
if (document.readyState === 'complete' &&
document.getElementById('adsense_area').clientHeight < 32)
document.getElementById('adsense_area').innerHTML = alternate_code;
}
}
7:58 pm on Aug 12, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month

joined:Mar 15, 2013
posts: 1148
votes: 116


Update: I tried that and it didn't work, so I'm missing something. No errors in the console, but this test did nothing, either:

document.addEventListener('DOMContentLoaded', (event) => {
if (document.readyState === 'complete')
alert('yes');
});


Using setInterval() worked, but I think that an event listener would use less resources. And if something gets hung up and the document never loads, the setInterval() could make things worse.

I did some research, and I suspect that the event had already fired by time the code got to this point. So this is my next test run, which I'll try later tonight:

var testLoaded = false;
if (document.readyState !== 'loading') {
altFunc();
}

else {
testLoaded = true;
document.addEventListener('DOMContentLoaded', altFunc);
}

function altFunc() {
if (testLoaded) { document.removeEventListener('DOMContentLoaded', altFunc); }

if (document.getElementById('adsense_area').clientHeight < 32)
document.getElementById('adsense_area').innerHTML = alternate_code;
}
8:28 pm on Aug 12, 2019 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:May 1, 2018
posts: 102
votes: 16


"I tried that and it didn't work, so I'm missing something. No errors in the console, but this test did nothing, either: "

I think DOMContentLoaded doesn't wait until the javascript, images and css has loaded.. What about if you try the loaded event?

if(window.addEventListener){window.addEventListener('load', function(){altFunc();}, false);
}else if(window.attachEvent){window.attachEvent('onload', function(){altFunc();});}
function altFunc(){
if (document.getElementById('adsense_area').clientHeight < 32)
document.getElementById('adsense_area').innerHTML = alternate_code;
}
}

I also see something interesting by doing a few searches in regards to 'AdsLoadedEvent.ADS_LOADED'. Maybe this will work?

if(window.addEventListener){window.addEventListener('AdsLoadedEvent.ADS_LOADED', function(){altFunc();}, false);
}else if(window.attachEvent){window.attachEvent('AdsLoadedEvent.ADS_LOADED', function(){altFunc();});}
4:22 pm on Aug 13, 2019 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Apr 1, 2016
posts:2662
votes: 794


I think this is playing with fire.

The solution is to use AdManager. Typically I would say that it is far more complicated then backup ads but when you're at the point where you are listening for ad-load events, I think AdManager should be well within your grasp.

The fundamental difference between AdManager and the AdBalancer is that the AdBalancer suppresses AdSense impressions based on a relative measure (% of total impressions). Whereas, adManager works on a fixed price floor. The difference is that if on a given day the AdSense market is particularly weak, then the number of impressions of your back-up ads can end up being much higher than expected. One advantage is that in my experience the AdBalancer surpresses ads based on somewhat arbitrary factors likes geo-location and time of day. So backups tend to be very poorly targetted. With AdManager you have more control and can end-up showing you backup ads to a better audience.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members