Quickstart - tapdaq/cordova-plugin GitHub Wiki
- 1. Installation
- 2. Initialise Tapdaq
- 3. Update GDPR consent
- 4. Display an advert
- 5. iOS specific steps
- 6. Android specific steps
We recommend the latest Cordova, this plugin supports 9.0.0 and above.
- Cordova CLI: 10.0.0
- Cordova iOS: 6.0.0
- Cordova Android: 9.0.0
For iOS to integrate the latest Tapdaq SDK, the Deployment target must be 8.0 or higher and be built with Xcode 11.0 or newer. If using an older version of Xcode then bitcode must be disabled.
For Android the minimum version support is API level 14.
The following networks have higher minimum requirements:
Network | Android API Level | Xcode | iOS Deployment Target |
---|---|---|---|
AdColony | 14 | Xcode 12.0 | Deployment Target: 9.0 |
AdMob | 16 | Xcode 11.0 | Deployment Target: 9.0 |
AppLovin | 16 | Xcode 8.0 | Deployment Target: 9.0 |
Chartboost | 21 | Xcode 8.0 | Deployment Target: 10.0 |
Facebook AN | 14 | Xcode 8.0 | Deployment Target: 9.0 |
InMobi | 15 | Xcode 11.0 | Deployment Target: 9.0 |
Maio | 16 | Xcode 11.0 | Deployment Target: 8.0 |
Pangle | N/A | Xcode 10.0 | Deployment Target: 8.0 |
Tapjoy | 14 | Xcode 9.3 | Deployment Target: 8.0 |
UnityAds | 14 | Xcode 8.0 | Deployment Target: 9.0 |
Vungle | 14 | Xcode 12.0 | Deployment Target: 8.0 |
YouAppi | 16 | Xcode 10.2 | Deployment Target: 9.0 |
Install or update Apache Cordova via npm:
npm install -g cordova
Add the platforms you wish to support:
cordova platform add android
cordova platform add ios
You will also need to install cocoapods for iOS, like so:
sudo gem install cocoapods
cordova plugin add @tapdaq/cordova-sdk
cordova plugin add @tapdaq/cordova-adcolony-adapter
cordova plugin add @tapdaq/cordova-admob-adapter
cordova plugin add @tapdaq/cordova-applovin-adapter
cordova plugin add @tapdaq/cordova-chartboost-adapter
cordova plugin add @tapdaq/cordova-fan-adapter
cordova plugin add @tapdaq/cordova-inmobi-adapter
cordova plugin add @tapdaq/cordova-ironsource-adapter
cordova plugin add @tapdaq/cordova-maio-adapter
cordova plugin add @tapdaq/cordova-pangle-adapter
cordova plugin add @tapdaq/cordova-tapjoy-adapter
cordova plugin add @tapdaq/cordova-unityads-adapter
cordova plugin add @tapdaq/cordova-vungle-adapter
cordova plugin add @tapdaq/cordova-youappi-adapter
> The **cordova build** command may need to be run after adding plugins
Tapdaq Android requires AndroidX, enable it in one of the following ways:
In the config.xml add the following preference:
<widget>
<preference name="AndroidXEnabled" value="true" />
</widget>
Add this plugin (or alternative) to enable AndroidX
cordova plugin add cordova-plugin-androidx
For large Android projects which include over 65k references, multidex may be necessary. To enable it, simply add this plugin (or alternative).
Note: This is not necessary for iOS only projects
cordova plugin add cordova-plugin-enable-multidex
iOS 14 Apple documentation recommends adding SKAdNetworkIds for each network which has been integrated, these ID's may change so please check the documentation for the latest ID's.
SKAdNetworkItems
key should be added to the app's Info.plist with type array. For each network ID a dictionary item should be added. Each dictionary should containt a single key-value pair with the key SKAdNetworkIdentifier
and value being the ID string.
This can be done via the Config.xml like so:
<widget>
<platform name="ios">
<config-file target="*-Info.plist" parent="SKAdNetworkItems">
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>zzzzz.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>xxxxx.skadnetwork</string>
</dict>
</array>
</config-file>
</platform>
</widget>
All of the ID's are maintained in this document and can also be found on each networks documentation
Network | ID | Link |
---|---|---|
AdColony | Multiple | Docs |
AdMob | cstr6suwn9.skadnetwork | Docs |
AppLovin | Multiple | Docs |
Chartboost | Multiple | Docs |
Facebook AN | Multiple | Docs |
InMobi | Multiple | Docs |
IronSource | su67r6k2v3.skadnetwork | Docs |
Maio | v4nxqhlyqp.skadnetwork | Docs |
Pangle | Multiple | Docs |
Tapjoy | Multiple | Docs |
UnityAds | Multiple | Docs |
Vungle | Multiple | Docs |
YouAppi | N/A | Docs |
To add in your iOS and Android App ID and Client Key, simply add the following inside your onDeviceReady() method.
var app: {
...
onDeviceReady: function() {
this.receivedEvent('deviceready');
const Tapdaq = cordova.require("cordova-plugin-tapdaq.Tapdaq");
const config = {
ios: {
appId: "YOUR_IOS_APP_ID",
clientKey: "YOUR_IOS_CLIENT_KEY"
},
android: {
appId: "YOUR_ANDROID_APP_ID",
clientKey: "YOUR_ANDROID_CLIENT_KEY"
}
};
const opts = {
didInitialise: function() {
// Tapdaq has initialised
},
didFailToInitialise: function(error) {
// Tapdaq failed to initialised
}
};
Tapdaq.init(config, opts);
}
};
You can find your App ID and Client Key by logging into the Tapdaq Dashboard, and then visiting Settings > General tab.
Note: If your app supports iOS and Android, you will need to create two separate apps on the Tapdaq dashboard.
Build and run your app to check the integration was successful.
cordova build ios
cordova run ios
cordova build android
cordova run android
Consent can be updated mid session as well as at initialisation, it can be set and unset.
Tapdaq.setUserSubjectToGDPR(Tapdaq.Status.TRUE);
Tapdaq.setConsent(Tapdaq.Status.TRUE);
Tapdaq.setAgeRestrictedUser(Tapdaq.Status.FALSE);
For Mintegral: for users outside the EU UserSubjectToGDPR must be set to FALSE to receive ads. For users inside the EU UserSubjectToGDPR must be TRUE with ConsentGiven also TRUE to receive ads.
To display an advert, please click on one of the following guides.
You can test that each ad network has been integrated correctly by visiting the Debugging page.
Please add the following entries in Target -> Info -> Custom iOS Target Properties. These steps are required when submitting your app to the App Store.
App Transport Security (ATS), introduced in iOS 9, improves user security and privacy by requiring apps to use secure network connections over HTTPS. However, some ad network adapters still use insecure network connections in their ad serving. As such, please follow the steps below to ensure your app passes Apple’s review process:
App Transport Security Settings: Set the type to Dictionary and add the "Allow Arbitrary Loads" key as a 'Boolean' type and set the value to 'YES'
You must also include you AdMob app ID in the app config.xml. This will then be automatically added to your info.plist when you build.
<widget>
<platform name="ios">
<config-file target="*-Info.plist" parent="GADApplicationIdentifier">
<string>ca-app-pub-0000000000000000~0000000000</string>
</config-file>
</platform>
</widget>
When including AdColony to your project, you must set the following three entries in order to submit your app to Apple:
NSCalendarsUsageDescription: Set the type to String and set the value to the following Some ad content may create a calendar event.
NSPhotoLibraryUsageDescription: Set the type to String and set the value to the following Some ad content may require access to the photo library.
NSCameraUsageDescription: Set the type to String and set the value to the following Some ad content may access camera to take picture.
NSMotionUsageDescription: Set the type to String and set the value to the following Some ad content may require access to accelerometer for interactive ad experience.
You must also include you AdMob app ID in the app config.xml. This will then be automatically added to your AndroidManifest.xml when you build.
<widget>
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-0000000000000000~0000000000"/>
</config-file>
</platform>
</widget>
Videos ads on Facebook Audience Network require hardware acceleration to be enabled either on the application or activity level. See full details on the Facebook website
For Android P (9.0) devices, in order to load ads a config must be added to the AndroidManifest.xml, see full details on the Facebook website
If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.