CAS.AI plugin for Cordova
Integrating CAS SDK into an app is the first step toward displaying ads and earning revenue. Once you've integrated and initialized the SDK, you can choose an ad format and follow the steps to implement it.
Prerequisites
Before adding the plugin, you need to modify the config.xml of project.
Make sure that your app's config.xml file uses the following minimum values:
<platform name="ios">
<preference name="SwiftVersion" value="5.0" />
<preference name="deployment-target" value="13.0" />
</platform>
<platform name="android">
<preference name="android-targetSdkVersion" value="35" />
<preference name="GradlePluginKotlinEnabled" value="true" />
<preference name="GradlePluginKotlinVersion" value="2.0.21" />
</platform>
CAS Plugin variables
Some required configuration steps for your project will be performed automatically using the CAS Gradle plugin for Android and the CAS Ruby script for iOS. You need to register your app on the https://cas.ai platform using the bundle package name for Android and the iTunes ID for iOS.
- For Android the bundle package name will be detected automatically.
- For iOS you must specify the registered iTunes ID in the
IOS_CAS_IDplugin variable. If you do not provide your iTunes ID, the ads in your app will be replaced with test ads.
All plugin variables must be defined within the <plugin> tag, for example IOS_CAS_ID.
<plugin name="cordova-plugin-casai" spec="*">
<variable name="IOS_CAS_ID" value="123456789" />
<!-- All plugin variables here -->
</plugin>
Mediated Networks
CAS.AI SDK offers three integration paths. Choose one based on your app’s target audience. If you're unsure which solution best fits your application, please contact your account manager.
Check the details of the ad network adapters supported by CAS.AI Mediation in the Android repository and iOS repository tables.
Optimal Ads Solution
Recommended for most applications targeting a general or mixed audience. Includes a broad set of stable, high-performance networks.
<variable name="IOS_CAS_SOLUTIONS" value="optimal" />
<variable name="ANDROID_CAS_SOLUTIONS" value="optimal" />
Families Ads Solution
Required for applications directed exclusively at children, in accordance with the Google Play Families Policy and fully compatible with the Children’s Online Privacy Protection Act (COPPA).
<variable name="IOS_CAS_SOLUTIONS" value="families" />
<variable name="ANDROID_CAS_SOLUTIONS" value="families" />
Choice networks
Advanced publishers familiar with ad network integrations can configure their own set of adapters.
Add the adapter names you want to CAS_ADAPTERS variables from the linked list for each platform, separating them with ,, ;, or a space ( ).
For Android, the name must match the variable names in the adapters {} block from the Android page. Below, as an example, only GoogleAds, CASExchange, and DTExchange are shown.
<variable name="ANDROID_CAS_ADAPTERS" value="googleAds casExchange dtExchange" />
Advertising Identifier
CAS Mediation uses the Google Advertising ID and Apple Identifier for Advertisers (IDFA) to deliver personalized and more relevant ads to each user.
To enable the use of the Advertising ID in your app, you need to complete the following setup steps.
CAS Mediation allows you to easily enable or disable (true or false) the use of the Advertising ID, depending on your app’s privacy requirements.
<variable name="ANDROID_USE_AD_ID" value="true" />
An application must not use an advertising identifier if at least one of the following conditions is true:
- The app’s target audience includes only children, as defined in the Families Policy.
- The app is being built for devices that do not use Google Play Services (e.g. Amazon or Huawei devices).
Add CAS.AI Cordova plugin
Include the CAS.AI plugin for Cordova in your project with cordova command:
cordova plugin add cordova-plugin-casai
You can also specify all variables directly in the plugin add command by adding --variable name=value for each variable.
cordova plugin add cordova-plugin-casai --variable IOS_CAS_ID=demo
To apply changes to the plugin variables, you need to remove and then re-add the plugin.
cordova plugin rm cordova-plugin-casai --nosave && cordova plugin add cordova-plugin-casai
Subscribe
Subscribe to receive notifications about CAS updates.