Skip to main content

Ads

Arkadium websites feature highly optimized monetization without any additional setup, including prerolls and multiple banner ads. However, there are additional opportunities to further enhance monetization. The following methods are supported by our SDK to implement these improvements.

Unlike video ads, banner ads are typically positioned alongside the game content and do not block gameplay.

Container

Prior to rendering a banner ad, you must define a location where it will be rendered and specify its dimensions. The following example demonstrates how to create a container for a square banner ad:

<div id="square-banner-ad" style="width: 300px; height: 250px"></div>

Triggering an Ad

After adding a container to the DOM, 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

This method accepts the following parameters:

  • adId: string: The ID of an existing DIV element that will serve as the container for the banner ad
  • dimensions: AdTypes[]: An array containing one or more values from sdk.ads.bannerSizes

Available Sizes

In digital advertising, there are several widely used ad formats. The following list includes 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 feature highly optimized monetization without any additional setup, including prerolls and multiple banner ads. However, there are additional opportunities to further enhance monetization. The following methods are supported by our SDK to implement these improvements.

Interstitial Ad

Interstitial ads are video advertisements that are triggered by the game during natural pause points, such as between rounds or after a level is completed.

sdk.ads.showInterstitialAd({duration: number}?): Promise<void>

A method to trigger an interstitial ad. Returns a promise that resolves after a specified duration (30 seconds by default), once the interstitial ad completes and control is returned to the game.

// ...
if (sdk.ads.showInterstitialAd) {
sdk.ads.showInterstitialAd()
.then(() => console.log('Interstitial finished!'));
}
// ...

The duration of the interstitial ad can be customized by passing a duration parameter to the API, as demonstrated in the following example:

// ...
if (sdk.ads.showInterstitialAd) {
sdk.ads.showInterstitialAd({ duration: 20 }); // Request a 20-second duration interstitial ad
.then(() => console.log('Interstitial finished!'));
}
// ...

Rewarded Ad

Rewarded ads are video advertisements that are typically triggered by a player to receive a reward, such as an additional life, a power-up, or other in-game benefits.

sdk.ads.showRewardAd({duration: number}?): Promise<RewardedAdResponse>

A method to trigger a rewarded ad. Returns a promise that resolves after a specified duration (30 seconds 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 can be customized by passing a duration parameter to the API, as demonstrated in the following example:

// ...
if (sdk.ads.showRewardAd) {
sdk.ads.showRewardAd({ duration: 20 }); // Request a 20-second duration rewarded ad
.then((response) => console.log('Rewarded Ad finished with: ' + response.value ? 'success' : 'fail'));
}
// ...

type RewardedAdResponse

The response object returned by sdk.ads.showRewardAd() contains the following properties:

  • value: number