emi-indo-cordova-plugin-admob
Cordova Plugin Admob Android and IOS
Mobile Ads SDK (Android: 22.6.0) Release Notes:
Mobile Ads SDK (IOS: 10.14.0) Release Notes:
Minimum Cordova Engines
- cordova-android version = 12.0.0
- cordova-ios version = 7.0.0
Minimum macOS | Xcode, and others
Guaranteed income using this plugin #14
> __Note__
> - ## It's Not a fork, it's purely rewritten, clean of 3rd party code.
> __Note__
> - ### No Ad-Sharing
> - ### No Remote Control
> - ### I guarantee 100% revenue for you.
> - [Code source:](https://github.com/googleads/googleads-mobile-android-examples) - Admob:
> -
VIDEO Test Collapsible banner ads
- Test Plugin with construct 3
VIDEO Test UMP or CMP SDK Android
- Test Plugin with construct 3
VIDEO Test UMP or CMP SDK IOS
- Test Plugin with construct 3
VIDEO Test Ad Type with Xcode/IOS
- Test Plugin with construct 3
💰Sponsor this project
Features
Features #1
- initialize
- targeting
- globalSettings
- AppTrackingTransparency (ATT)
- CMP SDK
- UMP SDK
- App Open Ads
- Banner Ads
- Interstitial Ads
- Rewarded Ads
- Mediation
- impression-level-ad-revenue
Installation
cordova plugin add emi-indo-cordova-plugin-admob --save --variable APP_ID_ANDROID=ca-app-pub-xxx~xxx --variable APP_ID_IOS=ca-app-pub-xxx~xxx
Remove
cordova plugin rm emi-indo-cordova-plugin-admob
Import the Mobile Ads SDK IOS
Then from the command line run:
- cd platforms/ios
Then from the command line run:
- pod install --repo-update
>>> Device Ready <<<
Methods: #2
// Support Platform: Android | IOS
cordova.plugins.emiAdmobPlugin.globalSettings([config_globalSettings]);
cordova.plugins.emiAdmobPlugin.targeting([config_Targeting]);
cordova.plugins.emiAdmobPlugin.initialize();
// UMP SDK 2.1.0
cordova.plugins.emiAdmobPlugin.getConsentRequest(); // (Platform: Both)
cordova.plugins.emiAdmobPlugin.consentReset(); // (Platform: Both)
cordova.plugins.emiAdmobPlugin.showPrivacyOptionsForm(); // (Platform: Both)
// CMP SDK 2.2.0
cordova.plugins.emiAdmobPlugin.requestIDFA(); // UMP SDK to handle Apple's App Tracking Transparency (ATT) (Platform: IOS)
cordova.plugins.emiAdmobPlugin.getIabTfc((IABTFC) => { console.log(JSONstringify(IABTFC)) }); // CMP SDK 2.2 (Platform: Both)
Note setDebugGeography #2
Testing is very easy, no need for VPN, TEST-DEVICE-HASHED-ID, or anything else, everything has been made programmatically.
must be false if the application is released to the play store / app store.
consent from will continue to be called regardless of its status 0,1,2,3,
until the value is changed to false.
setDebugGeography = true | false
example
document.addEventListener("deviceready", function(){
const config_globalSettings = [
setAppMuted = false, // default: false
setAppVolume = 1, // float: default: 1
enableSameAppKey = false, // default: false
npa = "1", // string "0" | "1"
enableCollapsible = true, // (BETA) activate the collapsible banner ads
responseInfo = false, // default: false
setDebugGeography = false // default: false
]
cordova.plugins.emiAdmobPlugin.getConsentRequest( (ststus) => { console.log("Consent Status: " + ststus) });
cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
document.addEventListener('on.get.consent.status', () => {
// Regardless of the state, call SDK initialize
cordova.plugins.emiAdmobPlugin.initialize();
cordova.plugins.emiAdmobPlugin.getIabTfc((IABTFC) => { console.log(JSONstringify(IABTFC)) });
});
}, false);
Event UMP SDK #3
on.get.consent.status
example:#4
document.addEventListener('on.get.consent.status', () => {
console.log("on get consent status");
});
Event CMP SDK #5
on.getIabTfc
on.TCString.expired
on.TCString.remove
Note #6
TCString expires 360 days, plugin automatically deletes it after 360 days. call consentRest()
example: #7
document.addEventListener('on.TCString.expired', () => {
console.log("on TCString expires 360 days");
cordova.plugins.emiAdmobPlugin.consentReset();
});
Global Variable adunitId
<script>
Ad format Demo ad unit ID
// https://developers.google.com/admob/android/test-ads
// https://developers.google.com/admob/ios/test-ads
var App_Open_ID;
var Banner_ID;
var Interstitial_ID;
var Rewarded_ID;
var Rewarded_Interstitial_ID;
if (window.cordova.platformId === 'ios') {
App_Open_ID = 'ca-app-pub-3940256099942544/5575463023';
Banner_ID = 'ca-app-pub-3940256099942544/2934735716';
Interstitial_ID = 'ca-app-pub-3940256099942544/4411468910';
Rewarded_ID = 'ca-app-pub-3940256099942544/1712485313';
Rewarded_Interstitial_ID = 'ca-app-pub-3940256099942544/6978759866';
} else {
// Assume Android
App_Open_ID = 'ca-app-pub-3940256099942544/9257395921';
Banner_ID = 'ca-app-pub-3940256099942544/6300978111';
Interstitial_ID = 'ca-app-pub-3940256099942544/1033173712';
Rewarded_ID = 'ca-app-pub-3940256099942544/5224354917';
Rewarded_Interstitial_ID = 'ca-app-pub-3940256099942544/5354046379';
}
</script>
AppOpenAd ADS
Methods:
// Support Platform: Android | IOS
cordova.plugins.emiAdmobPlugin.loadAppOpenAd([config_AppOpenAd]);
cordova.plugins.emiAdmobPlugin.showAppOpenAd();
example:
// WARNING config must be an array[] not an object{}
// adUnitId = call Global Variable
cordova.plugins.emiAdmobPlugin.loadAppOpenAd([ adUnitId = App_Open_ID, autoShow = true ]);
Event
on.appOpenAd.loaded
on.appOpenAd.failed.loaded
on.appOpenAd.dismissed
on.appOpenAd.failed.show
on.appOpenAd.show
on.appOpenAd.revenue
example:
document.addEventListener('on.appOpenAd.loaded', () => {
console.log("On App Open Ad loaded");
});
Methods:
cordova.plugins.emiAdmobPlugin.loadBannerAd([bannerConfig]);
cordova.plugins.emiAdmobPlugin.showBannerAd();
cordova.plugins.emiAdmobPlugin.hideBannerAd();
cordova.plugins.emiAdmobPlugin.removeBannerAd();
example:
// WARNING config must be an array[] not an object{}
// adUnitId = call Global Variable
const bannerConfig = [
adUnitId = Banner_ID,
position = "bottom-center",
size = "BANNER",
collapsible = "bottom", // (BETA) enable in globalSettings
adaptive_Width = 320, // Ignored
autoShow = true // boolean
]
cordova.plugins.emiAdmobPlugin.loadBannerAd(bannerConfig);
Position type string
top-right
top-center
left
center
right
bottom-center
bottom-right
Size type string
ANCHORED
IN_LINE
FULL_WIDTH
BANNER
FLUID
LARGE_BANNER
MEDIUM_RECTANGLE
FULL_BANNER
LEADERBOARD
adaptive_Width = number
Event
on.banner.load
on.banner.failed.load
on.banner.click
on.banner.close
on.banner.impression
on.banner.open
// new
on.banner.revenue
on.banner.remove
on.banner.hide
example:
document.addEventListener('on.banner.load', () => {
console.log("on banner load");
});
FULL Banner basic: index.html
Interstitial ADS
Methods:
// Support Platform: Android | IOS
cordova.plugins.emiAdmobPlugin.loadInterstitialAd([config_Interstitial]);
cordova.plugins.emiAdmobPlugin.showInterstitialAd();
example:
// WARNING config must be an array[] not an object{}
// adUnitId = call Global Variable
cordova.plugins.emiAdmobPlugin.loadInterstitialAd([ adUnitId = Interstitial_ID, autoShow = true ]);
Event
on.interstitial.loaded
on.interstitial.failed.load
on.interstitial.click
on.interstitial.dismissed
on.interstitial.failed.show
on.interstitial.impression
on.interstitial.show
// new
on.interstitial.revenue
example:
document.addEventListener('on.interstitial.loaded', () => {
console.log("on interstitial Ad loaded");
});
FULL Interstitial basic: index.html
Rewarded Interstitial ADS
Methods:
// Support Platform: Android | IOS
cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd([config_rewardedInt]);
cordova.plugins.emiAdmobPlugin.showRewardedInterstitialAd();
example:
// WARNING config must be an array[] not an object{}
// adUnitId = call Global Variable
cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd([ adUnitId = Rewarded_Interstitial_ID, autoShow = true ]);
Event
on.rewardedInt.loaded
on.rewardedInt.failed.load
on.rewardedInt.click
on.rewardedInt.dismissed
on.rewardedInt.failed.show
on.rewardedInt.impression
on.rewardedInt.showed
on.rewardedInt.userEarnedReward
// new
on.rewardedInt.revenue
on.rewardedInt.ad.skip
example:
document.addEventListener('on.rewardedInt.loaded', () => {
console.log("on rewarded Interstitial load");
});
FULL Rewarded Interstitial basic: index.html
Rewarded ADS
Methods:
// Support Platform: Android | IOS
cordova.plugins.emiAdmobPlugin.loadRewardedAd([config_rewarded]);
cordova.plugins.emiAdmobPlugin.showRewardedAd();
example:
// adUnitId = call Global Variable
cordova.plugins.emiAdmobPlugin.loadRewardedAd([ adUnitId = Rewarded_ID, autoShow = true ]);
Event
on.rewarded.loaded
on.rewarded.failed.load
on.rewarded.click
on.rewarded.dismissed
on.rewarded.failed.show
on.rewarded.impression
on.rewarded.show
on.reward.userEarnedReward
// new
on.rewarded.revenue
on.rewarded.ad.skip
example:
document.addEventListener('on.rewarded.loaded', () => {
console.log("on rewarded Ad loaded");
});
FULL Rewarded basic: index.html
Features and Coming soon #13
## Features
- SDK initialize
- targeting
- globalSettings
- App Open Ads
- Banner Ads
- Interstitial Ads
- Rewarded Ads
- Rewarded interstitial Ads
- [Consent](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/Advanced%20topics/consent.html)
- Mediation
- impression-level-ad-revenue
- GDPR IAB TFCv2.2
- AppTrackingTransparency (ATT)
- Collapsible banner ads (BETA)
## Coming soon
- App Open Ads ( Finished )
- User Consent ( Finished )
- Mediation ( Finished )
- https://developers.google.com/admob/android/native/start
- https://developers.google.com/admob/android/impression-level-ad-revenue ( Finished ) v1.1.9
- https://developers.google.com/admob/android/ssv
- https://developers.google.com/admob/android/privacy/gdpr ( Finished ) v1.4.0 [index.html](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/Advanced%20topics/consent_GDPR_IAB_TFCv2.2.html)
- https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/ ( Finished ) v1.4.0 [index.html](https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/Advanced%20topics/consent_GDPR_IAB_TFCv2.2.html)
IAB Europe Transparency & Consent Framework
Example How to read consent choices #12
// index.html https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/Advanced%20topics/consent_GDPR_IAB_TFCv2.2.html
```sh
// >>>>>>>> New features (UMP) SDK v2.1.0
// https://developers.google.com/admob/android/privacy/gdpr
/*
If the user chooses not to display ads,
you can restrict access to the app, or ban it,
until they change their decision back,
Just call showPrivacyOptionsForm();
*/
cordova.plugins.emiAdmobPlugin.getIabTfc(
(info) => {
// How to read consent choices
console.log("IABTCF_gdprApplies: " + info.IABTCF_gdprApplies);
console.log("IABTCF_PurposeConsents: " + info.IABTCF_PurposeConsents);
console.log("IABTCF_TCString: " + info.IABTCF_TCString);
// A small example
var fundingChoices;
fundingChoices = info.IABTCF_PurposeConsents;
if (fundingChoices === "1111111111"){
// Enable app features.
loadRewardedAd();
} else if (fundingChoices === "") {
// disable app features.
} else {
// You have to test everything yourself.
console.log(info);
}
},
(error) => {
console.log("Error: " + error);
});
```
Admob Mediation
Mediation #9
## get Mediation Adapter Name
responseInfo = true // (debugging)
## Meta Audience Network
[Integrate Meta Audience Network with bidding :](https://developers.google.com/admob/android/mediation/meta)
- (Adapter default: 6.13.7.0)
### Installation
```sh
cordova plugin add emi-indo-cordova-plugin-mediation-meta
```
- ================================
## Unity Ads
[Integrate Unity Ads with Mediation :](https://developers.google.com/admob/android/mediation/unity)
- (Adapter default: 4.6.1.0)
### Installation
```sh
cordova plugin add emi-indo-cordova-plugin-mediation-unity
```
- ================================
## AppLovin Ads
[Integrate AppLovin with Mediation :](https://developers.google.com/admob/android/mediation/applovin)
- (Adapter default: 11.8.2.0)
### Installation
```sh
cordova plugin add emi-indo-cordova-plugin-mediation-applovin
```
- ================================
## AdColony Ads
[Integrate AdColony with Mediation :](https://developers.google.com/admob/android/mediation/adcolony)
- (Adapter default: 4.8.0.1)
### Installation
```sh
cordova plugin add emi-indo-cordova-plugin-mediation-adcolony
```
- ================================
## Chartboost Ads
[Integrate Chartboost with Mediation :](https://developers.google.com/admob/android/mediation/chartboost)
- (Adapter default: 9.2.1.0)
### Installation
```sh
cordova plugin add emi-indo-cordova-plugin-mediation-chartboost
```
- ================================
## ironSource Ads
[Integrate ironSource with Mediation :](https://developers.google.com/admob/android/mediation/ironsource)
- (Adapter default: 7.2.7.0)
### Installation
```sh
cordova plugin add emi-indo-cordova-plugin-mediation-ironsource
```
Variables name or preference name
Variables name #10
> __Warning__
> This is so that if I don't have time to update the Mediation Adapter version later, you can do it yourself as below.
- Cordova CLI Update Adapter version with Variables
```sh
cordova plugin add emi-indo-cordova-plugin-mediation-meta --variable META_ADAPTER_VERSION="xxxxx"
```
- Update Adapter version with config.xml
```sh
```
### Variables Name
- --variable META_ADAPTER_VERSION="xxxxx"
- --variable UNITY_ADAPTER_VERSION="xxxxx"
- --variable APPLOVIN_ADAPTER_VERSION="xxxxx"
- --variable ADCOLONY_ADAPTER_VERSION="xxxxx"
- --variable CHARTBOOST_ADAPTER_VERSION="xxxxx"
- --variable IRONSOURCE_ADAPTER_VERSION="xxxxx"
### preference name
- META_ADAPTER_VERSION
- UNITY_ADAPTER_VERSION
- APPLOVIN_ADAPTER_VERSION
- ADCOLONY_ADAPTER_VERSION
- CHARTBOOST_ADAPTER_VERSION
- IRONSOURCE_ADAPTER_VERSION
- ================================
💰Sponsor this project
Earn more money, with other ad networks.
Other plugins #11
- ### emi-indo-cordova-plugin-fan
[Facebook Audience Network:](https://github.com/EMI-INDO/emi-indo-cordova-plugin-fan) - Ads:
- ### emi-indo-cordova-plugin-unityads
[Cordova Plugin Unity:](https://github.com/EMI-INDO/emi-indo-cordova-plugin-unityads) - Ads:
## New Open AI
- ### emi-indo-cordova-plugin-open-ai
[Cordova Plugin Open Ai:](https://github.com/EMI-INDO/emi-indo-cordova-plugin-open-ai) - Open AI:
## New Firebase Analytics
- ### emi-indo-cordova-plugin-fanalytics
[Cordova Plugin Firebase Analytics:](https://github.com/EMI-INDO/emi-indo-cordova-plugin-fanalytics) - Firebase Analytics: