API References
When you load monetization framework, you can access _bsa
with methods that you can use to load and design ads. Here is the list of methods that you should know.
init
The init
method loads the ad unit on the page based on the variables and options you pass into it. You can refer to the quick start guide for the options this method accepts.
initBatch
The initBatch
method accepts the same parameters as init
method, but instead of making a request every time it initiates, it combines them into a single batch which you can call later with loadBatch
method.
loadBatch
The loadBatch
takes the combined requests from initBatch
and send a single request to load ads on the site. Refer to Batch Request for detailed examples.
reload
The reload
method lets you refresh/reload the ad. This method accepts the unique class or id value of the ad container.
Example of reload method
// For this example, the id is "bsaBanner"
<div id="bsaBanner"></div>
<script>
// Pass the id into the parameter to reload the ad
_bsa.reload('#bsaBanner')
</script>
close
The close
method lets you hide the ad for a specified amount of time. It will set a cookie to prevent the framework from making another ad request until the cookie expires. It accepts only the id
of the element and time
. By default, the ad stays hidden for six hours if you don't pass the time
value.
Example of close method
<div id="bsaBanner"></div>
<span onclick="_bsa.close('bsaBanner')">Hide Ad</span>