Monetization Framework
Callback Event
You can use BSANativeCallback
function to retrieve the attributes from the request. Here is the list of attributes you can access through this callback.
Attribute | Note |
---|---|
type | The ad format rendering type |
key | The zone key for the request |
segment | The segment or placement of this request |
options | The value of options you pass into _bsa.init |
ads | The response from the request |
Handling empty ads
You can check the length of of the ads
to see whether the API has returned any ads. Here is an example:
function BSANativeCallback({ ads, key }) {
console.log(JSON.stringify(ads, null, 2))
console.log(`${ads.length} ad(s) was served in zone ${key}`)
if (ads.length === 0) {
// Do something here to display fallback banner
}
}