Skip to content

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:

javascript
window.JOGOS_SDK.ad;
Advertisement Requirements

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.).
javascript
// 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.

javascript
const result = await window.JOGOS_SDK.ad.getRewardAdCount();
console.log('Remaining rewardAd count ', result);

Ad Block Detection

Advertisement Requirements
Our game design allows it to continue running when ad blocking is active, but the detection mechanism may have false positives. To avoid false positives affecting normal users, it is recommended to take mild restrictive measures: only restrict value-added content (such as special skins, extra levels, etc.) for users with ad blockers, and ensure that full functionality can be restored by simply refreshing the page after disabling the ad blocker. Please be sure to improve the automatic save function to prevent progress loss due to page refresh, which may affect the user experience.

Use the following method to detect if the user has blocked ads:

javascript
const result = await window.JOGOS_SDK.ad.hasAdblock();
console.log('Adblock usage fetched', result);