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 parameters. o
should be an object
containing the parameters of adBreak
.
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 2024-09-03 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 2024-09-03 UTC."],[[["`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."]]],[]]