Ad break method
Stay organized with collections
Save and categorize content based on your preferences.
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', ...});
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-25 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-25 UTC."],[[["\u003cp\u003e\u003ccode\u003eGameSnacks.ad.break()\u003c/code\u003e is used to integrate interstitial and rewarded ads into your game, utilizing the Ad Placement API.\u003c/p\u003e\n"],["\u003cp\u003eThis method accepts an object with parameters specifying the ad type and related callbacks for various ad events like display, dismissal, and reward.\u003c/p\u003e\n"],["\u003cp\u003eDirect usage of the Ad Placement API or manual injection of adbygoogle.js is discouraged; GameSnacks handles these aspects.\u003c/p\u003e\n"],["\u003cp\u003eImplementing ads requires adherence to the GameSnacks monetization requirements to ensure proper integration and functionality.\u003c/p\u003e\n"],["\u003cp\u003eExamples demonstrate using \u003ccode\u003eGameSnacks.ad.break()\u003c/code\u003e for displaying ads between levels (interstitial) and offering rewarded ads.\u003c/p\u003e\n"]]],[],null,[]]