Ads & Commercialization
Learn how to trigger Commercial Interstitials and Rewarded Video Ads in your game.
In-Game Advertisements
BentoTiles supports two primary ad break formats for HTML5 and WebGL games:
- Commercial Mid-rolls (Interstitials): Displayed at natural break points (level completion, game over, or menu returns).
- Rewarded Video Ads: Optional ads watched by players in exchange for in-game perks (extra lives, coins, or continues).
📺 Commercial Break (Interstitials)
Trigger a commercial ad break when the player dies, finishes a level, or pauses the game:
BentoTiles.commercialBreak({
beforeAd: () => {
console.log("Ad starting: Mute audio and pause game engine");
},
afterAd: () => {
console.log("Ad finished: Unmute audio and unpause game engine");
},
adError: (err) => {
console.warn("Ad failed or was blocked:", err.message);
}
});🎁 Rewarded Break (Rewarded Video Ads)
Rewarded ads give players a tangible in-game reward after completing a short video ad.
BentoTiles.rewardedBreak({
beforeAd: () => {
// Mute game sound
},
afterAd: () => {
// Unmute game sound
},
rewardGranted: () => {
// Player watched the full ad! Give reward (+100 coins, extra life, etc.)
player.coins += 100;
saveProgress();
},
adDismissed: () => {
// Player closed the ad early without earning reward
showToast("Ad closed early — no reward granted.");
}
});🚫 AdBlock Detection
Check if the player's browser is blocking ad scripts:
const isBlocked = await BentoTiles.isAdBlockActive();
if (isBlocked) {
console.log("AdBlock is active");
}