SDK

Ads

Smaz Games decides whether an ad plays. Your game asks through the SDK, and every request resolves with a clear result, including when ads are off. Games must never load ad code of their own. See the Monetization policy for the commercial rules.

What is available now

Ad typeStatusHow
Display ads around the game pageShown by the site on desktop game pages when ads are onNothing to do. Never inside your game
Rewarded adsAvailable when the site has a rewarded ad unit configured. Otherwise unavailableshowRewardedAd()
Midgame adsNot enabled. Always unavailableshowMidgameAd()
In-game bannersNot offered. Always unavailablerequestBanner()

Check adsEnabled and adTypes from init() before showing a "watch an ad" button.

Rewarded ads

A rewarded ad is one the player chooses to watch in exchange for something in your game, such as a second life or extra coins.

const env = await OpenArcade.init();
rewardButton.hidden = !env.adTypes.includes('rewarded');

rewardButton.onclick = async () => {
  OpenArcade.gameplayStop();
  const result = await OpenArcade.showRewardedAd();
  if (result.rewardGranted) giveExtraLife();
  else showMessage('No reward this time. You can carry on playing.');
  OpenArcade.gameplayStart();
};

Rules:

  • Request one only after the player pressed a button that clearly says an ad will play, such as Watch an ad for an extra life.
  • Grant the reward only when rewardGranted is true. dismissed and unavailable grant nothing.
  • Always offer a way to continue without watching. A rewarded ad must never be needed to finish a level or the game.
  • One ad per reward. Do not chain ads.
  • Do not pressure players with countdowns or repeated prompts.

While the ad plays the site pauses and mutes your game: onHost receives { paused: true, muted: true, ad: true }, then the previous state with ad: false. The site waits up to 10 seconds for an ad to load before reporting unavailable.

Midgame ads

A midgame ad plays at a natural break, such as between levels. They are not enabled on Smaz Games, so showMidgameAd() resolves with { status: 'unavailable', reason: 'disabled' } at once (reason 'frequency' if you asked less than 3 minutes earlier). You may call it at your natural breaks now so nothing changes if they are enabled later. If they are, the site will show at most one every 3 minutes.

async function nextLevel() {
  OpenArcade.gameplayStop();
  await OpenArcade.showMidgameAd();   // resolves immediately when no ad plays
  loadLevel(level + 1);
  OpenArcade.gameplayStart();
}

Never call it during play, on a menu button press, or when the player has just arrived.

Ad blockers

isAdBlocked() resolves to true when ads are live but the site's ad script could not load. It resolves to false when ads are off. Use it only to hide a rewarded-ad button. Never block play, show warnings or take anything away from players who use an ad blocker.

Banners

Banners on Smaz Games are placed by the site around the player frame, on desktop game pages only. Games cannot show banners inside the frame. requestBanner() and clearBanner() resolve with { status: 'unavailable', reason: 'host-rendered' }, so code written for other platforms keeps working.

Ads and younger players

Signed-in players under 18 receive only non-personalised ads, and the site's ad partners are told the player is under the age of consent. Your game does not need to do anything for this.

Testing

In local test mode, add ?smazAds=simulate to show a 3-second placeholder ad for both types. Close it early to test dismissed. In the SDK test game, ads follow the site's real settings. In private previews ads are always off, so requests return unavailable with reason disabled.