Following the docs on https://developers.google.com/custom-search-ads/docs/implementation-guide I created some code to retrieve ads on a search result page.
This code assumes that you place a container on your webpage where the function
new google.ads.search.Ads(pageOptions, adblock1, adblock2);
appends an iFrame to that may contain ads. I say MAY contain, because sometimes the iFrames stay empty.
Question: Now I need to know whether there are any ads displayed in the containers or not. How do I do this?
Any suggestions welcome! :)
Regards, Jorn
the callback function, that maybe helps you is:
'noAdLoadedCallback':
function(containerName, adsLoaded) {
if (!adsLoaded) {
try {
---- do something here ---
}
catch (e) {}
}
}
You can put this on each adblock.
Cheers Nik
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With