You'll need to import the javascript file in your website before starting from this .
const {
bannerAd,
fullScreenAd,
rewardsAd,
} = WTN.AdMob;
bannerAd({
adId:"ca-app-pub-3940256099942544/6300978111"
})
fullScreenAd({
adId:"ca-app-pub-3940256099942544/1033173712",
fullScreenAdCallback: (value) => {
console.log(value)
}
})
rewardsAd({
adId:"ca-app-pub-3940256099942544/5224354917",
rewardsAdCallback: (value) => {
console.log(value)
}
})
/** Example for fullScreenAd
fullScreenAd({
adId:"ca-app-pub-3940256099942544/1033173712",
fullScreenAdCallback: (value) => {
console.log(value);
try{
let response = JSON.parse(value);
let status = response.status;
let error = response.error;
let additionalData = response.additionalData;
let rewardsData = response.rewardsData;
// Your code to handle the values accordingly.
}
catch(e){
console.log("JSON parse error : ",e);
}
}
})
*/
import {
bannerAd,
fullScreenAd,
rewardsAd,
} from "webtonative/AdMob";
bannerAd({
adId:"ca-app-pub-3940256099942544/6300978111"
})
fullScreenAd({
adId:"ca-app-pub-3940256099942544/1033173712",
fullScreenAdCallback: (value) => {
console.log(value)
}
})
rewardsAd({
adId:"ca-app-pub-3940256099942544/5224354917",
rewardsAdCallback: (value) => {
console.log(value)
}
})
/** Example for fullScreenAd
fullScreenAd({
adId:"ca-app-pub-3940256099942544/1033173712",
fullScreenAdCallback: (value) => {
console.log(value);
try{
let response = JSON.parse(value);
let status = response.status;
let error = response.error;
let additionalData = response.additionalData;
let rewardsData = response.rewardsData;
// Your code to handle the values accordingly.
}
catch(e){
console.log("JSON parse error : ",e);
}
}
})
*/
bannerAd, fullScreenAd and rewardsAd can be called for displaying the particular ad.
fullScreenAdCallback and rewardsAdCallback - This callback function is called on successfully displaying the ad, when it is dismissed or in case of any error with values like status, error, additionalData and rewardsData.
status - Values for status will be
"success" - When ad is show successfully.
"adDismissed" - When ad is dismissed by user.
"adLoadFailure" - When ad could not be loaded.
"adError" - When ad could not be loaded on full screen.
"rewardSuccess" - When user completes the reward ad.