how can I include admob in a vue3 and cordova project. I've tried so many ways from different sites but none of them worked so far or I don't know where to put the admob code..
Basically I create a Vue3 project, then
vue add cordova
Inside src-cordova:
cordova plugin add cordova-admob
and the vue build (dist) folder I've moved it to src-cordova www folder.
But where exactly do I add the code bellow ??
on onDeviceReady() {
document.removeEventListener('deviceready', onDeviceReady, false);
// Set AdMobAds options:
admob.setOptions({
publisherId: "ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB", // Required
interstitialAdId: "ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII", // Optional
autoShowBanner: true, // Optional
autoShowRInterstitial: false, // Optional
autoShowRewarded: false, // Optional
tappxIdiOS: "/XXXXXXXXX/Pub-XXXX-iOS-IIII", // Optional
tappxIdAndroid: "/XXXXXXXXX/Pub-XXXX-Android-AAAA", // Optional
tappxShare: 0.5 // Optional
});
// Start showing banners (atomatic when autoShowBanner is set to true)
admob.createBannerView();
// Request interstitial ad (will present automatically when autoShowInterstitial is set to true)
admob.requestInterstitialAd();
// Request rewarded ad (will present automatically when autoShowRewarded is set to true)
admob.requestRewardedAd();
}
document.addEventListener("deviceready", onDeviceReady, false);