Ad break method

  • The break method places interstitial and rewarded ads in your game.

  • This method wraps the Ad Placement API's adBreak function and accepts the same parameters in an object o.

  • Some parameters within the o object, such as beforeReward, adDismissed, and adViewed, are exclusively for rewarded ads.

  • Do not directly inject adsbygoogle.js or use the Ad Placement API yourself when using this method.

break(
  o: {
     type: '<type>',
     name: '<name>',
     beforeAd: () => {},
     afterAd: () => {},
     beforeReward: (showAdFn) => {},
     adDismissed: () => {},
     adViewed: () => {},
     adBreakDone: (placementInfo) => {},
  }
): void;

Places interstitial and rewarded ads in your game.

This method wraps adBreak from the Ad Placement API and supports the same parameter. o should be an object containing the parameters of adBreak.

For more details see Ad Placement API Documentation

Note

Parameters like beforeReward, adDismissed, adViewed are rewarded ads only.

Your game shouldn't inject adsbygoogle.js or use the Ad Placement API directly.

Requirements

See monetization requirements.

Examples

Interstitial ad between levels:

GameSnacks.ad.break({type: 'next', ...});

Rewarded ad:

GameSnacks.ad.break({type: 'reward', ...});