Working with ads is implemented via connector.ads interface. Connector supports three types of advertisement: rewarded, interstitial and sticky banner.
Supported Platforms
- ✅
Yandex Games
- ✅
VK Games
- ✅
OK Games
- ✅
Crazy Games
- ✅
Facebook Instant Games
- ✅
Android
- ✅
Amazon
- ✅
iOS
- ✅
MSN
- ✅
Rustore
- ✅
Samsung
- ✅
Plinga
- ✅
Xiaomi
- ✅
GDCom
- ✅
Wortal
- ✅
GameSnacks
Available properties:
// Is AdBlock enabled
connector.ads.isAdBlockEnabled;
// Is the banner available
connector.ads.isStickyAvailable;
connector.ads.isInterstitialAvailable;
connector.ads.isRewardedAvailable;
// Is the ads playing now
connector.ads.isStickyPlaying;
connector.ads.isInterstitialPlaying;
connector.ads.isRewardedPlaying;
Rewarded
Rewarded Video is a non-skippable video ad that aims to give the player a reward for watching. It is forbidden to show without a reward.
// Show rewarded video, returns a promise
const success = await connector.ads.showRewardedVideo();
if (success) {
// success
}
// Showing started
connector.ads.on('rewarded:start', () => {});
// Showing ended
connector.ads.on('rewarded:close', (success) => {});
// Reward is received
connector.ads.on('rewarded:reward', () => {});
Interstitial
Interstitial is pop-up, often fullscreen skippable (sometimes only after a few seconds) advertising. Usually it is shown in transition between levels. Its displaying is prohibited during the gameplay on many platforms. It is allowed to show only in pause between game sessions. It is also prohibited during the navigation by the VK Games platform. So, we will consider this a bad practice on other platforms too.
// Show interstitial, returns a promise
connector.ads.showInterstitial();
// Showing started
connector.ads.on('interstitial:start', () => {});
// Showing ended
connector.ads.on('interstitial:close', (success) => {});
Sticky banner
Sticky banner is a fixed bottom banner. It takes ~50-100px (110px VK Direct Games). The banner must not cover the play region.
Supported Platforms
- ✅
Yandex Games
- ✅
VK Games
- ✅
OK Games
- ✅
Facebook Instant Games (only in mobile app)
- ✅
Android
- ✅
iOS
- ✅
MSN
- ✅
Rustore
- ✅
Samsung
- ✅
Xiaomi
// Show the sticky banner, then it will auto-update itself
connector.ads.showSticky();
// Refresh the sticky banner, forced refreshing
connector.ads.refreshSticky();
// Close the sticky banner
connector.ads.closeSticky();
// Open the banner
connector.ads.on('sticky:start', () => {});
// The banner appears on the screen
connector.ads.on('sticky:render', () => {});
// The banner updated
connector.ads.on('sticky:refresh', () => {});
// Close the banner
connector.ads.on('sticky:close', () => {});
Members
(static) isRewardedSupported :Boolean
Is rewarded ad supported on this platform
- Boolean
(static) isRewardedAvailable :Boolean
Is rewarded ad available now
- Boolean
(static) isRewardedPlaying :Boolean
Is rewarded ad playing now
- Boolean
(static) isInterstitialSupported :Boolean
Is interstitial ad supported on this platform
- Boolean
(static) isInterstitialAvailable :Boolean
Is interstitial ad available now
- Boolean
(static) isInterstitialPlaying :Boolean
Is interstitial ad playing now
- Boolean
(static) isStickySupported :Boolean
Is sticky banner supported on this platform
- Boolean
(static) isStickyAvailable :Boolean
Is sticky banner ad available now
- Boolean
(static) isStickyPlaying :Boolean
Is sticky banner ad playing now
- Boolean
(static) isAdBlockEnabled :Boolean
Does user have an ad block
- Boolean
Methods
(static) showRewardedVideo() → {Promise.<Boolean>}
Show rewarded ad video
- Type:
- Promise.<Boolean>
(static) showInterstitial() → {Promise.<Boolean>}
Show interstitial ad video
- Type:
- Promise.<Boolean>
(static) showSticky() → {Promise.<Boolean>}
Show sticky banner
- Type:
- Promise.<Boolean>
(static) refreshSticky() → {Promise.<Boolean>}
Refresh sticky banner
- Type:
- Promise.<Boolean>
(static) closeSticky() → {Promise.<Boolean>}
Close sticky banner
- Type:
- Promise.<Boolean>