Video Ads
This module implements interstitial video and rewarded video ads. Read the section related to your game engine on the JOGOS_SDK Introduction
page, and use the relevant functions of video ads as follows:
window.JOGOS_SDK.ad;
Please be sure to read our Advertisement Requirements, because if your game does not comply with these requirements, your game will be rejected without any feedback.
Request to Play Video Ads
We support two different types of video ads: interstitial ads (midgame
) and rewarded ads (rewarded
);
- Interstitial ads: Interstitial ads in the game can be triggered as appropriate when the user dies, completes a level, etc.
- Rewarded ads: Users actively request to watch rewarded ads in exchange for rewards (extra lives, revival when the character dies, extra items, extra attributes, etc.).
// Callback function
const callbacks = {
// This function will be called when the ad starts playing
onstarted: () => console.log('ad started'),
// This function will be called when the ad finishes playing
onfinished: () => console.log('ad finished'),
// This function will be called when an error occurs while playing the ad
onerror: (error) => console.log('ad error:', error),
};
// Request to display interstitial ads
window.JOGOS_SDK.ad.requestAd('midgame', callbacks);
// Request to display rewarded ads
window.JOGOS_SDK.ad.requestAd('rewarded', callbacks);
Notes on Calling Ads
Interstitial ads have a minimum refresh time (usually 60 seconds). Frequent calls will trigger an exception:
500 At least a ${time} second interval is required to display new advertisements
.Rewarded ads have a maximum daily limit (usually 30 times per user per day). Excessive calls will trigger an exception:
500 You can only watch up to ${max} rewarded ads per day
.We recommend that when designing rewarded ad placements, you set a cooldown period or a daily limit for the ad placements. You can also use the following interface to get the remaining number of rewarded ads for the current user to decide whether your rewarded ads need to be hidden.
const result = await window.JOGOS_SDK.ad.getRewardAdCount();
console.log('Remaining rewardAd count ', result);
Ad Block Detection
Use the following method to detect if the user has blocked ads:
const result = await window.JOGOS_SDK.ad.hasAdblock();
console.log('Adblock usage fetched', result);