Ads
Banner Ads
Arkadium websites have very optimized monetization without any additional setup - we show prerolls, several banner ads, etc. Though, there are some additional opportunities to improve monetization even further. Here are the methods our SDK supports to do these improvements.
Unlike video ads, banners typically live aside the game content and don't block the game itself.
Container
Prior to rendering a banner ad you need to define a place where it will render and a size for it. Here's how to create a container for square banner add:
<div id="square-banner-ad" style="width: 300px; height: 250px"></div>
Triggering an Ad
After you put a container to DOM, you need to execute the following method:
sdk.ads.showBannerAd(
"square-banner-ad", // This should be equal to ID of the DIV element
[sdk.ads.bannerSizes.AD_300x250]
);
sdk.ads.showBannerAd(adId: string, dimensions: AdTypes[]): void
The method accepts the following parameters:
adId: string
: ID of an existing DIV element which will act as a container for a banner ad;dimensions: AdTypes[]
: one ofsdk.ads.bannerSizes
;
Available Sizes
In ads world, there are some widly used ads format. Here is a list of the most popular ad formats:
300x250
<div id="square-banner-ad" style="width: 300px; height: 250px"></div>
<script>
sdk.ads.showBannerAd(
"square-banner-ad", // This should be equal to ID of the DIV element
[sdk.ads.bannerSizes.AD_300x250]
);
</script>
728x90
<div id="leaderboard-banner-ad" style="width: 728px; height: 90px"></div>
<script>
sdk.ads.showBannerAd(
"leaderboard-banner-ad", // This should be equal to ID of the DIV element
[sdk.ads.bannerSizes.AD_728x90]
);
</script>
320x50
<div id="mobile-banner-ad" style="width: 320px; height: 50px"></div>
<script>
sdk.ads.showBannerAd(
"mobile-banner-ad", // This should be equal to ID of the DIV element
[sdk.ads.bannerSizes.AD_320x50]
);
</script>
300x600
<div id="skyscraper-banner-ad" style="width: 300px; height: 600px"></div>
<script>
sdk.ads.showBannerAd(
"skyscraper-banner-ad", // This should be equal to ID of the DIV element
[sdk.ads.bannerSizes.AD_300x600]
);
</script>
Video Ads
Arkadium websites have very optimized monetization without any additional setup - we show prerolls, several banner ads, etc. Though, there are some additional opportunities to improve monetization even further. Here are the methods our SDK supports to do these improvements.
Interstitial Ad
Interstitial ads are video ads that are being triggered by a game in some natural pauses - between rounds, after a level is finished, etc.
sdk.ads.showInterstitialAd({duration: number}?): Promise<void>
A method to trigger an Interstitial ad. Returns a promise which resolves after a certain duration (30s by default), after Interstitial ad finishes and control can be passed back to game.
// ...
if (sdk.ads.showInterstitialAd) {
sdk.ads.showInterstitialAd()
.then(() => console.log('Interstitial finished!'));
}
// ...
The duration of the Interstitial Ad shown can be customised by passing a duration parameter to the API as follows:
// ...
if (sdk.ads.showInterstitialAd) {
inst.ads.showInterstitialAd({ duration: 20 }); // Request for a 20 seconds duration Interstitial Ad
.then(() => console.log('Interstitial finished!'));
}
// ...
Rewarded Ad
Rewarded ads are typically video ads that are being triggered by a player to get some reward: an additional live, a powerup, etc.
sdk.ads.showRewardAd({duration: number}?): Promise<RewardedAdResponse>
A method to trigger a rewarded ad. Returns a promise which resolves after a certain duration (30s by default):
// ...
if (sdk.ads.showRewardAd) {
sdk.ads.showRewardAd()
.then((response) => console.log('Rewarded Ad finished with: ' + response.value ? 'success' : 'fail'));
}
// ...
The duration of the Rewarded Ad shown can be customised by passing a duration parameter to the API as follows:
// ...
if (sdk.ads.showRewardAd) {
inst.ads.showRewardAd({ duration: 20 }); // Request for a 20 seconds duration Rewarded Ad
.then((response) => console.log('Rewarded Ad finished with: ' + response.value ? 'success' : 'fail'));
}
// ...
type RewardedAdResponse
The response of sdk.ads.showRewardAd()
contains the following properties:
value
: number