AI-generated Key Takeaways
-
The
breakmethod places interstitial and rewarded ads in your game. -
This method wraps the Ad Placement API's
adBreakfunction and accepts the same parameters in an objecto. -
Some parameters within the
oobject, such asbeforeReward,adDismissed, andadViewed, are exclusively for rewarded ads. -
Do not directly inject
adsbygoogle.jsor 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', ...});