Skip to content

Ads (Cocos)

Two ad types: interstitial (non‑opt‑in, full‑screen break) and rewarded (player opts in, gets a reward on completion).

Gate the UI — don’t expose a “Watch ad” button if no provider is ready.

if (FRVRSDK.instance.isRewardedReady()) {
  showWatchAdButton();
}

if (FRVRSDK.instance.isInterstitialReady()) {
  // Interstitial can be attempted here
}
await FRVRSDK.instance.showInterstitial();

Resolves whether the ad showed or was skipped/throttled. There’s no distinct “completed” state for interstitials — the promise settling is the signal that the ad view ended.

import { AdShowResult } from './frvr-sdk/FRVRSDK';

const result = await FRVRSDK.instance.showRewarded();
if (result === AdShowResult.COMPLETED) {
  giveReward();                 // watched to the end — grant the reward
} else if (result === AdShowResult.SKIPPED) {
  // ad showed but the user dismissed it before the end — no reward
} else {
  // AdShowResult.FAILED — nothing was shown (no fill / throttled / error)
}

Grant the reward only on COMPLETED. SKIPPED means the ad was shown but the user dismissed it before the end (no reward); FAILED means nothing was shown (no fill / throttled / error). Skip and failure are distinct values, so you can tell a deliberate skip apart from a delivery failure.

async onDoubleRewardButtonClicked() {
  this.doubleRewardButton.interactable = false;
  try {
    const result = await FRVRSDK.instance.showRewarded();
    if (result === AdShowResult.COMPLETED) {
      this.currentRunCoins *= 2;
      this.toast('Rewarded!');
    } else if (result === AdShowResult.SKIPPED) {
      this.toast('Watch the full ad to earn your reward');
    } else {
      this.toast('Ad unavailable right now');
    }
  } catch {
    this.toast('Ad unavailable right now');
  } finally {
    this.doubleRewardButton.interactable = true;
  }
}

Interstitials are throttled by the underlying SDK (≈5 minute cooldown, ≈100s init block). Rewarded ads are not throttled. If an interstitial “does nothing”, it’s usually the throttler — not a bug.

  • Waterfall, throttling knobs, ad types that the Web SDK exposes beyond Cocos’s subset: Web SDK ads.