In this case there are two events inserted. In one event Ad Server returns ad (ADS_WRITTEN_TO_AD_SLOT) in the second one (NO_AD_RETURNED_FOR_AD_SLOT) it does not return anything. In case that ad server does not have any ad to display “inline styl display:none“ is set for given ad-slot id.
If ad is sent to be displayed, CSS class with name isAd is set for ad-slot id. The class adds caption "ad".
<!DOCTYPE html>
<html>
<head>
<title>Test page iBB Support</title>
<meta name="charset" content="utf-8"/>
<style>
.isAd:before {
content: "Ad";
}
</style>
<script id='ibbTagEngine' language='javascript' src='//bbcdn-static.bbelements.com/scripts/ibb-async/stable/tag.js'></script>
<script>
var adserver = ibbAds.tag.useAdProvider('BbmEu');
adserver.manageAdSlot('leaderboard', '10452.10.1.3');
adserver.manageAdSlot('square', '10452.10.1.2');
var getIbbId = ibbAds.tag.useDataProvider('BbnautIdDataProvider', {
url : '//bbcdn-static.bbelements.com/scripts/ibb-async/stable/plugins/BbnautIdDataProvider.js'
});
adserver.attachData("ibbid", getIbbId);
ibbAds.tag.on("NO_AD_RETURNED_FOR_AD_SLOT", function(event) {
var id = event.getData().getCustomId();
document.getElementById(id).style.display= "none";
});
ibbAds.tag.on("ADS_WRITTEN_TO_AD_SLOT", function (event) {
var id = event.getData().slotId;
document.getElementById(id).className = "isAd";
});
ibbAds.tag.requestAndPlaceAds();
</script>
</head>
<body>
<div id="leaderboard"> </div>
<div id='square'></div>
</body>
</html>