Googletag is there a way to know when there is no ads loaded
I have to show ads on my page and a defaultImage when there is no ads.
googletag.defineSlot('/6355419/Travel', [250, 200], 'ad-slot-2') .addService(googletag.pubads());
In there a way to record no ads in code in order to show the defaultImage ?
You could use an event listener such as slotRenderEnded (documentation here)
// This listener is called when a slot has finished rendering. googletag.pubads().addEventListener('slotRenderEnded', function(event) { var slot = event.slot; var isEmpty = event.isEmpty; if (isEmpty) { //add your default image } } );Alternatively, you might be interested in using googletag.content() as detailled here.