Advertising
Overview
SpellSync allows you to implement the display of advertisements or rewarded videos in the game. Advertising in SpellSync is handled using the Ads Manager ss.ads
. The manager manages banners on the game page:
- Ad display;
- Automatic update timer management;
- Advertising show frequency.
Supported platforms
Platforms without support
Additional Sections
🗃️ Third-Party Advertising Providers
3 items
Ad Manager
FREEThe ad manager rules over the banners on the page. Its responsibility consists in displaying ads, managing auto-refresh and ads frequency timers.
Available ad manager properties:
- JavaScript
- Unity
// Is AdBlock enabled
ss.ads.isAdblockEnabled;
// Is the banner available
ss.ads.isStickyAvailable;
ss.ads.isFullscreenAvailable;
ss.ads.isRewardedAvailable;
ss.ads.isPreloaderAvailable;
// Is the ads playing now
ss.ads.isStickyPlaying;
ss.ads.isFullscreenPlaying;
ss.ads.isRewardedPlaying;
ss.ads.isPreloaderPlaying;
// Check enabled advertising overlays
// Countdown overlay before displaying fullscreen ads is enabled
ss.ads.isCountdownOverlayEnabled;
// Overlay is enabled for failed display of rewarded video
ss.ads.isRewardedFailedOverlayEnabled;
// Can fullscreen ads be shown on the platform before gameplay starts
ss.ads.canShowFullscreenBeforeGamePlay;
// Is AdBlock enabled
SS_Ads.IsAdblockEnabled();
// Is ads available
SS_Ads.IsFullscreenAvailable();
SS_Ads.IsPreloaderAvailable();
SS_Ads.IsRewardedAvailable();
SS_Ads.IsStickyAvailable();
// Is the ads playing now
SS_Ads.IsFullscreenPlaying();
SS_Ads.IsPreloaderPlaying();
SS_Ads.IsRewardPlaying();
SS_Ads.IsStickyPlaying();
/// Check enabled advertising overlays
// Countdown overlay before displaying fullscreen ads is enabled
SS_Ads.IsCountdownOverlayEnabled();
// Overlay is enabled for failed display of rewarded video
SS_Ads.IsRewardedFailedOverlayEnabled();
// Can fullscreen ads be shown on the platform before gameplay starts
SS_Ads.CanShowFullscreenBeforeGamePlay();
You can subscribe for the following basic events:
- JavaScript
- Unity
// Ads show started
ss.ads.on('start', () => {});
// Ads show ended
ss.ads.on('close', (success) => {});
private void OnEnable()
{
SS_Ads.OnAdsStart += OnAdsStart;
SS_Ads.OnAdsClose += OnAdsClose;
}
private void OnDisable()
{
SS_Ads.OnAdsStart -= OnAdsStart;
SS_Ads.OnAdsClose -= OnAdsClose;
}
private void OnAdsStart(){
// When ads started
}
private void OnAdsClose(bool success){
// When ads ended
}
Fullscreen
FREEFullscreen banner or 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.
Call example:
- JavaScript
- Unity
// Show fullscreen, returns a promise
ss.ads.showFullscreen();
// Show fullscreen with a countdown overlay before displaying the advertisement
ss.ads.showFullscreen({ showCountdownOverlay: true });
// Showing started
ss.ads.on('fullscreen:start', () => {});
// Showing ended
ss.ads.on('fullscreen:close', (success) => {});
// Show fullscreen
public void ShowFullscreen() => SS_Ads.ShowFullscreen(OnFullscreenStart, OnFullscreenClose);
// Showing started
private void OnFullscreenStart() => Debug.Log("ON FULLSCREEN START");
// Showing ended
private void OnFullscreenClose(bool success) => Debug.Log("ON FULLSCREEN CLOSE");
Preloader
FREEPleloader is a banner that appears when loading the game. On many platforms, it is implemented through Fullscreen, but is not tied to its timers (except for Yandex.Games).
Displaying is allowed only before the start of the game.
Call example:
- JavaScript
- Unity
// Show preloader, returns a promise
ss.ads.showPreloader();
// Showing started
ss.ads.on('preloader:start', () => {});
// Showing ended
ss.ads.on('preloader:close', (success) => {});
// Show preloader
public void ShowPreloader() => SS_Ads.ShowPreloader(OnPreloaderStart, OnPreloaderClose);
// Showing started
private void OnPreloaderStart() => Debug.Log("ON PRELOADER: START");
// Showing ended
private void OnPreloaderClose(bool success) => Debug.Log("ON PRELOADER: CLOSE");
Rewarded Video
FREERewarded 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.
Call example:
- JavaScript
- Unity
// Show rewarded video, returns a promise
ss.ads.showRewardedVideo();
// Show rewarded video with an option to display an overlay
// in case of an unsuccessful display of the rewarded video
ss.ads.showRewardedVideo({ showFailedOverlay: true });
// Asynchronously
const success = await ss.ads.showRewardedVideo();
if (success) {
ss.player.add('gold', 5000);
}
// Showing started
ss.ads.on('rewarded:start', () => {});
// Showing ended
ss.ads.on('rewarded:close', (success) => {});
// Reward is received
ss.ads.on('rewarded:reward', () => {});
// Show rewarded video
public void ShowRewarded() => SS_Ads.ShowRewarded("COINS", OnRewardedReward, OnRewardedStart, OnRewardedClose);
// Showing started
private void OnRewardedStart() => Debug.Log("ON REWARDED: START");
// Reward is received
private void OnRewardedReward(string value)
{
if (value == "COINS")
Debug.Log("ON REWARDED: +150 COINS");
if (value == "GEMS")
ConsoleUI.Instance.Log("ON REWARDED: +5 GEMS");
}
// Showing ended
private void OnRewardedClose(bool success) => Debug.Log("ON REWARDED: CLOSE");
Sticky Banner
FREESticky banner is a fixed bottom banner. It takes ~50-100px (110px VK Direct Games). The banner must not cover the play region.
In the panel, you can customize the auto-refresh frequency. The banner will be updated according to the specified frequency immediately of the start.
Call example:
- JavaScript
- Unity
// Show the sticky banner, then it will auto-update itself
ss.ads.showSticky();
// Refresh the sticky banner, forced refreshing
ss.ads.refreshSticky();
// Close the sticky banner
ss.ads.closeSticky();
// Open the banner
ss.ads.on('sticky:start', () => {});
// The banner appears on the screen
ss.ads.on('sticky:render', () => {});
// The banner updated
ss.ads.on('sticky:refresh', () => {});
// Close the banner
ss.ads.on('sticky:close', () => {});
// Show the sticky banner, then it will auto-update itself
public void ShowSticky() => SS_Ads.ShowSticky();
// Refresh the sticky banner, forced refreshing
public void RefreshSticky() => SS_Ads.RefreshSticky();
// Close the sticky banner
public void CloseSticky() => SS_Ads.CloseSticky();
// Open the banner
private void OnStickyStart() => Debug.Log("ON STICKY: START");
// Close the banner
private void OnStickyClose() => Debug.Log("ON STICKY: CLOSE");
// The banner appears on the screen
private void OnStickyRender() => Debug.Log("ON STICKY: RENDER");
// The banner updated
private void OnStickyRefresh() => Debug.Log("ON STICKY: REFRESH");
Supported platforms
Platforms without support
Stay in Touch
Other documents of this chapter available Here. To get started, welcome to the Tutorials chapter.
SpellSync Community Telegram
: @spellsync.
For your suggestions e-mail
: [email protected]
We Wish you Success!