Ads

Ad integration flow

Step 1: Developer account

If you already have one, skip. Otherwise contact BD/operations for merchant portal access: https://gameplatform.upliveapp.com

Step 2: Create game

Create the game in the portal and ask the platform to enable API access.

Step 3: Integrate JSSDK ads in your game

JSSDK ad APIs

Step1: Load JSSDK

<script type="text/javascript" src="https://h-cdn.pengpengla.com/up/opengamejs/1.4.0/assets/seed.js"></script>

Step2: Initialize SDK

Call openSdk.init before other APIs.

Parameter Required Default Description
env No pro stage / pro
client_id Yes Application ID
game_id Yes Game ID
mode Yes Use ad for ads
openSdk.init({
env: 'stage',
client_id: 'CLIENT_ID',
game_id: 'GAME_ID',
mode: 'ad'
});

Step3: Ad APIs

Prerequisites

1) OAuth

2) PV/UV ping

1. Banner / Landing video

Configure LandingPage assets in the merchant portal (name, description, screenshots 202×358px).

Call openSdk.ads.showLandingVideo. start runs when user taps “Start game”.

Parameter Required Description
start Yes Start game callback
openSdk.ads.showLandingVideo({
start: function() {
alert('Enter game');
}
});

2. Rewarded video

Parameter Required Description
open_id Yes User open_id
success Yes Video completed; grant reward on server
close Yes false = early close; true = completed then closed
error Yes Load failed

Requires OAuth. See OAuth.

Example

openSdk.ads.showRewardVideo({
open_id: 'OPEN_ID',
success: function() {
alert('Grant reward on server')
},
close: function(status){
if (status) {
alert('Closed after complete');
} else {
alert('Closed before complete');
}
},
error: function() {
alert('Ad load failed');
}
});