AI-generated Key Takeaways
-
GameSnacks.ad.break()
is used to integrate interstitial and rewarded ads into your game, utilizing the Ad Placement API. -
This method accepts an object with parameters specifying the ad type and related callbacks for various ad events like display, dismissal, and reward.
-
Direct usage of the Ad Placement API or manual injection of adbygoogle.js is discouraged; GameSnacks handles these aspects.
-
Implementing ads requires adherence to the GameSnacks monetization requirements to ensure proper integration and functionality.
-
Examples demonstrate using
GameSnacks.ad.break()
for displaying ads between levels (interstitial) and offering rewarded ads.
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', ...});