FB-Instant-Games-ADS-Controller icon indicating copy to clipboard operation
FB-Instant-Games-ADS-Controller copied to clipboard

Learn how to integrate games built with JavaScript and HTML5 with Facebook instant games SDK

Instant Game ADS-Controller

Learn how to integrate Fb audience network with instant games / games built with HTML5 & JavaScript

1. Ads-Contoller file should be placed in the main folder of the game (the same folder that contains index.html)

2. Start by importing the AdsController by adding this line in the body of your index file


3. Open AdsController.js file and replace the xxxxxxxxxxxx_xxxxxxxxxxxx with your Interstitial & Rewarded Video IDs

const INTERSTITIAL_PLACEMENT_ID = 'xxxxxxxxxxxx_xxxxxxxxxxxx'; //*-------- Interstitial -------*//
const REWARDED_PLACEMENT_ID = 'xxxxxxxxxxxx_xxxxxxxxxxxx'; //*-------- Rewarded Video -----*//

4. Start Pre-loading your ADS by calling

LoadRewarded();
LoadInter();

5. Ads can be shown anywhere you want by calling this function

ShowRewarded();
ShowInter();

AdsContoller enables you to Load your ADS at any time you like, and then to show it at any time you like easily by using the following functions :

Interstitial

Load Interstitial in 10s Show Interstitial in 15s


Rewarded Video

Load RewardedVideo in 16s Show RewardedVideo in 32s


NB : Do not call the Interstitial & Rewarded Video functions at the same time & same place !