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
<script src="AdsController.js"></script>
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
<script> window.setInterval(LoadInter, 10000); // Load Interstitial in 10s window.setInterval(ShowInter, 15000); // Show Interstitial in 15s </script>
Rewarded Video
Load RewardedVideo in 16s
Show RewardedVideo in 32s
<script> window.setInterval(LoadRewarded, 16000); // Load RewardedVideo in 16s window.setInterval(ShowRewarded, 32000); // Show RewardedVideo in 32s </script>
NB : Do not call the Interstitial & Rewarded Video functions at the same time & same place !