Outstream Units
Execute custom JavaScript code on ad ended
Run custom JavaScript code when an outstream ad ends
The example below runs custom JavaScript code once the outstream unit has finished playing its ad. adEnd fires each time an ad ends — also when the ad errors out or no ad is returned; listen to adError if you need to tell those cases apart.
Example:
$bos("DIV_ID", {
"id":"UNIT_ID",
"width":"480",
"height":"270"
});
$bos("DIV_ID").on("adEnd", function(){
console.log("Ad is finished!");
});