Banner
This module implements the display and removal of banner ads. After reading the section related to your game engine on the JOGOS_SDK Introduction
page, you can use the relevant functions as follows:
window.JOGOS_SDK.banner;
Please read our Advertisement Requirements, as your game will be rejected without feedback if it does not comply with these requirements.
Request to Display Banner Ad
There are a total of 5 sizes available for banner ads:
- Leaderboard (728x90)
- Medium (300x250)
- Mobile (320x50)
- Homepage (468x60)
- Large Mobile (320x100)
- Only 2 banner ads of different sizes can be displayed at the same time.
- The same banner ad position must be displayed for 60 seconds before it can be refreshed again.
- If the banner does not follow the above rules and sizes, it is likely not to be displayed.
First, you need to create a container for the banner ad on the screen, optionally specifying the width and height:
<div id="banner-container" style="width: 300px; height: 250px"></div>
Then use the following method to request displaying the banner ad (note that the id
must match the id
of the container):
try {
await window.JOGOS_SDK.banner.requestBanner('banner-container');
} catch (e) {
console.log('Banner request error', e);
}
A maximum of two banner ads can be displayed at the same time; otherwise, an exception will be thrown: '500 At most two banners can be displayed at the same time'.
Executing this method with the same id
will replace the original ad. Repeating the execution within a specified time (typically 60 seconds) will throw an exception: 500 The time for each call to method requestBanner cannot exceed ${time} seconds
.
Remove Specified Banner
Then use the following method to remove the banner with the specified id
:
await window.JOGOS_SDK.banner.clearBanner('banner-container');
Remove All Banners
Then use the following method to remove all banners:
await window.JOGOS_SDK.banner.clearAllBanners();
Local Testing
During local testing, real ads will not be displayed. To view the final display effect, you can package your game and upload it to the QA tool on the developer platform for testing.