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.
Example
// ...
if (sdk.ads.showInterstitialAd) {
sdk.ads.showInterstitialAd()
.then(() => console.log('Interstitial finished!'));
}
// ...
sdk.ads.showInterstitialAd(): Promise<void>
A method to trigger an interstitial ad. Returns a promise which resolves in approximately 30 seconds, after interstitial ad finishes and control can be passed back to game.
Rewarded Ad
Rewarded ads are typically video ads that are being triggered by player to get some reward: an additional live, a powerup, etc.
Example
// ...
if (sdk.ads.showRewardAd) {
sdk.ads.showRewardAd()
.then((reward) => console.log('Reward received: ' + reward.value));
}
// ...
sdk.ads.showRewardAd(): Promise<RewardResponse>
A method to trigger a rewarded ad. Returns a promise which resolves in approximately in 30s with a RewardResponse
type value.
type RewardResponse
The response of sdk.ads.showRewardAd()
contains the following properties:
value
: number