Getting Started
This documentation will help you integrate ConsoliAds Mediation iOS SDK to get instant access to the best ad networks around the globe for optimized mobile ad analytics and earnings.
Before you proceed to integrate, make sure you have:
- Registered at ConsoliAds (https://portal.consoliads.com)
- Logged in to the ConsoliAds dashboard (https://portal.consoliads.com)
Create an App
NOTE: You can skip this step if you’ve already created your app on ConsoliAds dashboard
1. From the left side bar, navigate to Apps-> New App
2. Simply import your Live app or manually enter the required information and proceed to ‘Finish’ to instantly create your app
Download iOS SDK
1. Download the latest ConsoliAds iOS SDK for your required from https://portal.consoliads.com/download/iOS
Setting Up Project Dependencies
Integrating SDK
Once the ConsoliAds mediation SDK is downloaded:
- Place all of the files in your project root (all files are mandatory).
- Add all files in project except “libConfigureServer.out”
- Place “libConfigureServer.out” in the root directory of the project.
Requirements and settings to work with ConsoliAds mediation:
- XCode version should be 8 or higher.
- Deployment Target should be equal to greater than 9.
- ConsoliAds-mediation requires a device to run (would not build on simulator)
- Disable “Bitcode” option in build settings
- Add “–ObjC” flag in “Other linker flags” in build settings
- In your Xcode project, select your target Build Settings and
- Enable module option (c and objective-c)
- Enable Objective-C Exceptions
- In Target > link Binary with libraries add
- Libc++.1.tbd
- lbsqlite3.0.tbd.
** Your project settings should be ready to support ConsoliAds in your iOS code to add all the ad placements for all supported ad formats **
Ready to Code
SDK Initialization
Import “ConsoliAdsMediation.h” and set up app’s name and bundle ID as follows:
[ConsoliAdsMediation sharedInstance].productName=@"Your App Name"; [ConsoliAdsMediation sharedInstance].bundleIdentifier=@"com.app.name";
Now initialize by:
[[ConsoliAdsMediation sharedInstance] initialize:isDevMode boolUserConsent:userConsent viewController:self];
Parameter details:
- isDevMode: when TRUE, simulates the development environment and fetches all settings from ‘Dev Placeholders’. Complete app development should be done with ‘Dev Mode’ ON. When your app is ready to be published, please note:
- ‘Dev Mode’ MUST BE FALSE
- If you make your build with ‘Dev Mode’ TRUE, the ad configurations from ‘Dev. Placeholder and Ads‘ tab on the dashboard would be used.
- If you make your build with ‘Dev Mode’ FALSE, the ad configurations from ‘Live Placeholder and Ads‘ tab on the dashboard would be used.
- userConsent: TRUE if user agrees to share his data and opts for personalized ads, FALSE otherwise. This flag is used for GDPR and CCPA compliance.
- viewController: Reference of the active view controller
To receive event when ConsoliAds Mediation gets initialized, you need to register the ‘ConsoliAdsMediationDelegate’ delegate before initializing mediation:
[[ConsoliAdsMediation sharedInstance] setDelegate:yourMediationInitDelegate];
The following event is fired on initialization success:
-(void) onConsoliAdsInitializationSucces:(BOOL)status;
Initialize Placeholders
Once initialized, the SDK is ready to show ads. However, showing ads requires placeholders to have ad networks added:
- Go to your ConsoliAds dashboard Apps -> Manage ->
-> Placeholders & Ads - Add required ad networks (Interstitial, Video, Rewarded Video, Banner, Native, Icon) to your app as shown below:
Show Interstitial/Video Ad
Now add the following lines of code to show an interstitial ad in your app:
[[ConsoliAdsMediation sharedInstance] showInterstitial:sceneIndex viewController:self];
Parameter details:
- sceneIndex: index of the placeholder from ‘Placeholders & Ads’ section on the ConsoliAds dashboard e.g. if MainMenu is your first placeholder and you wish to show Interstitial on it, then your code will look like:
[[ConsoliAdsMediation sharedInstance] showInterstitial:0 viewController:self];
NOTE: the respective placeholder must have an ad network added from the ConsoliAds dashboard, else no ad will be displayed
To receive events for Interstitial Ads register ‘ConsoliAdsMediationInterstitialAdDelegate’ delegate as follows:
[[ConsoliAdsMediation sharedInstance] setInterstitialAdDelegate: yourInterstitialDelegate];
Show Rewarded Video Ad
Load Rewarded Ad
Showing rewarded video requires loading it beforehand. Use the following to load a rewarded ad:
[[ConsoliAdsMediation sharedInstance] loadRewarded:sceneIndex];
It is highly recommended to call LoadRewarded:sceneIndex as early as possible to allow videos to be pre-loaded.
Availability of Rewarded Ad
Despite having the ad load called, rewarded video availability should be explicitly checked. Check rewarded video ad availability by using following method:
(BOOL)isRewardedVideoAvailable:(NSInteger)sceneIndex;
Return value (boolean) :
- True if the ad is available
- False if the ad is not available
Show Rewarded Video
[[ConsoliAdsMediation sharedInstance]showRewardedVideo:sceneIndex viewController:self];
Parameter details:
• sceneIndex: index of the placeholder from ‘Placeholders & Ads’ section on the ConsoliAds dashboard e.g. if MainMenu is your first placeholder and you wish to show Interstitial on it, then your code will look like:
[[ConsoliAdsMediation sharedInstance]showRewardedVideo:0 viewController:self];
• self: Reference of the active view controller
NOTE: the respective placeholder must have an ad network added from the ConsoliAds dashboard, else no ad will be displayed
Reward Users
In order to reward your user, a callback needs to be implemented with your lines of code to incentivize the user. ConsoliAds mediation SDK implements a single callback irregardless of any ad network used.
Receive events for Rewarded Video Ads by registering ‘ConsoliAdsMediationRewardedAdDelegate’ delegate as follows:
[[ConsoliAdsMediation sharedInstance] setRewardedAdDelegate: yourRewardedVideoDelegate];
Provide the following definition of the method to reward your users:
-(void) onRewardedVideoAdCompleted { //Write your code to reward your user here }
Show Banner Ad
To show banner ads you need to first create the object of the CAMediatedBannerView as follows:
bannerView = [[CAMediatedBannerView alloc] init];
Now use the following code to display the banner:
[[ConsoliAdsMediation sharedInstance] showBannerWithIndex:sceneIndex bannerView:bannerView viewController:self];
You can show custom banner by setting following property of the mediated view before the show call:
[bannerView setCustomBannerSize:CGSizeMake(width,height)]
Parameter details:
- width: your preferred width for your banner view
- height: your preferred height for your banner view
Hide Banner Ad
To hide banner, use the following:
[[ConsoliAdsMediation sharedInstance] destroyBannerView:bannerView];
To receive events for Banner Ads register ‘CAMediatedBannerAdViewDelegate’ delegate as follows:
bannerView.delegate = self;
Show Native Ad
- Create a custom view class of type UIView and implement the ‘CANativeAdRenderingDelegate’ protocol:
@interface MyMediatedNativeAdView
- Create the following UI elements inside this class to get the native ad contents ready:
@interface MyMediatedNativeAdView
- Create the following UI elements inside this class to get the native ad contents ready:
• @property (strong, nonatomic) IBOutlet UILabel *titleLabel; (to contain the native ad title string) • @property (strong, nonatomic) IBOutlet UILabel *bodyLabel; (to contain the native ad body string) • @property (strong, nonatomic) IBOutlet UILabel *advertiserTextLabel; (to contain the native ad advertiser string) • @property (strong, nonatomic) IBOutlet UIView *videoView; (to contain the native ad content View) • @property (strong, nonatomic) IBOutlet UIImageView *iconImageView; (to contain the native ad icon image) • @property (strong, nonatomic) IBOutlet UIButton *callToAction; (to contain the native ad action button) • @property (strong, nonatomic) IBOutlet UIImageView *privacyPolicyIconImageView; (to contain the native ad privacy policy view)
- Implement the following methods provided by CANativeAdRenderingDelegate protocol and provide the above UI elements to load native ad contents:
• (UILabel *) nativeTitleTextLabel; • (UILabel *) nativeBodyTextLabel; • (UILabel *) nativeAdvertiserTextLabel; • (UIImageView *) nativeIconImageView; • (UIView *) nativeVideoView; • (UIButton *) nativeCallToActionButton; • (UIView *) nativePrivacyInformationIconImageView; • (NSLayoutConstraint *) iconAdWidthConstraint;
Your custom view class’s implementation for native ad mediation should look like this:
@implementation MyMediatedNativeAdView -( UILabel *) nativeTitleTextLabel { return self.titleLabel; } -( UILabel *) nativeBodyTextLabel { return self.bodyLabel; } … … @end
Now show native ad using:
[[ConsoliAdsMediation sharedInstance] loadNativeAdInViewController:yourViewController sceneIndex:sceneIndex delegate:yourNativeAdDelegate];
You need to register ‘CANativeAdRequestDelegate’ delegate to get yourself notified for the events fired against each activity for the native ads, such as native ad loaded, native ad failed to load.
When native ad is loaded, implement the following method to populate view with native ad contents:
-(void)onNativeAdLoaded:(CAMediatedNativeAd *)nativeAd ){ [nativeAd registerViewForInteractionWithNativeAdView:self.nativeAdView]; }
You can destroy native ad using:
[self.nativeAdView removeFromSuperview]; self.nativeAdView = nil;
Show Icon Ad
Add the following to get the icon ad:
IconAdBase *iconBase = (IconAdBase*)[[ConsoliAdsMediation sharedInstance] loadIconAd:sceneIndex viewController:self delegate:self];
Load and show icon ad using:
If( iconAdBase != nil ) { IconAdView *view = [[IconAdView alloc] initWithAd:iconBase animationType:KCAAdScaleIconAnimation]; [self.iconView addSubview:view]; }
Parameter details:
- KCAAdScaleIconAnimation: values available:
- KCAAdNoIconAnimation
- KCAAdRotationIconAnimation
- KCAAdScaleIconAnimation
- view: view at which you want to display icon ad
Configure Server
Configure Server performs a sync of your app on the dashboard that makes use of your given app information. The sync performs the following:
1. Integrated Ad Networks: all the integrated ad networks are pushed to the dashboard to make sure that changes only to the respective ad networks can be done.
NOTE: Configure Server DOES NOT change any Live configurations of the app. The settings have to be ‘Move To Live’ before the app goes Live on the app store
Now open the terminal and go to the root directory of the project to run the following command:
./libConfigureServer.out userSignature packageName platform
NOTE: make sure that you had already moved the libConfigureServer.out when going through ‘Integrating SDK’ section of this documentation
Parameter details:
1. userSignature: essential to identify the user according to his role and rights provided on the ConsoliAds dashboard in order to configure settings of the specific app
a.The user signature can be obtained by going to your Personal Info by clicking on your name in the right corner of the top bar on your ConsoliAds dashboard
2. packageName: your app’s unique package name such as com.x.y
3.platform: (google, apple, amazon) is used by ConsoliAds ONLY to fetch the information of your app according to the given platform from the ConsoliAds dashboard
A sample call for configure server looks like:
./libConfigureServer.out 5d4b02b39dc419548ea8183e8d3ea170 com.seasonapps.myfitnessguide apple
** Congratulations, You are ready to build your app on to your iOS mobile device to see all the ad placements showing ads according to your Test Mode **
Hide All Ads
If you want to hide all ads, except Rewarded Ads, from your entire app, use the following:
[[ConsoliAdsMediation sharedInstance] hideAllAds];
NOTE: You only need to call this method once in your code to hide all ads from your app
Using More Apps URL and Support Email
- The more apps URL and support email are added against a particular brand
- When an app of the respective brand is configured, the more apps URL and support email are available for use
- To access more apps URL, use:
[ConsoliAdsMediation sharedInstance].asMoreAppsURL;
To access support email, use:
[ConsoliAdsMediation sharedInstance].supportEmail
Applying Dev Settings to Live
In order to see the ‘Dev Mode’ settings on ConsoliAds dashboard, open the ‘
Placeholder and Ads‘ tab in the details of your specific app then click ‘Dev. Placeholder & Ads’ as shown below:
Here you will see all the changes you have made from the inspector. Click ‘Apply on Live App’ to apply these configurations to your live app.
App Settings on ConsoliAds Dashboard
After successfully integrating your app with ConsoliAds SDK, following app settings can be explored on the ConsoliAds dashboard in the App Details section:
Test Mode
By Default a new application is in Test Mode. In Test Mode only test ads are shown. Test Mode can ONLY be disabled by importing your app’s Live credentials in the Details tab.
Ad Network IDs
If you are using Admob, Facebook Audience Network or Chartboost you need to provide their Ad IDs on the dashboard in your app Ad Networks section.
All other integrated ad networks will automatically go Live once your app’s Test Mode is disabled.
Ad Filters
Apply all ad filters, for the integrated ad networks, with complete ease from the ConsoliAds dashboard in the Ad Filters section of the app details.
Debug Logs
If enabled, debug logs will be shown for your app in respective editors for Android and iOS.
Child Directed
Child Directed enables your application with complete COPPA compliance.
Hide Ads
All ads, except Rewarded Videos, can be completely turned OFF using Hide Ads on the dashboard.
Auto Mediation
Auto Mediation automatically optimizes your ad networks for each region and each ad format pertaining to every placeholder in your app such that you get the best eCPMs.
We highly recommend to use Auto Mediation in order to witness instant revenue increments upto 20%
For Advance Development
Check Interstitial Availability
You can also check for interstitial ad availability for a specific placeholder using the following method.
(BOOL)isInterstitialAvailable:(NSInteger)sceneIndex;
Return value (boolean):
- True if the ad is available
- False if the ad is not available
More Delegate Events
ConsoliAds implements single delegate events for all Ad Networks. Following events can be used as per need:
Interstitial/Video Ad Events
- -(void) onInterstitialAdShown;
- -(void) onInterstitialAdClicked;
- -(void) onInterstitialAdClosed;
- -(void) onInterstitialAdFailedToShow;
Rewarded Video Ad Events
- -(void) onRewardedVideoAdLoaded;
- -(void) onRewardedVideoAdFailToLoad;
- -(void) onRewardedVideoAdShown;
- -(void) onRewardedVideoAdCompleted;
- -(void) onRewardedVideoAdClicked;
- -(void) onRewardedVideoAdFailToShow;
- -(void) onRewardedVideoAdClosed;
Banner Ad Events
- -(void)onBannerAdLoaded:(CAMediatedBannerView*)bannerView;
- -(void)onBannerAdLoadFailed;
- -(void)onBannerAdClicked;
- -(void)onBannerAdRefreshEvent;
Icon Ad Events
- -(void)didCloseIconAd;
- -(void)didClickIconAd;
- -(void)didDisplayIconAd;
- -(void)didRefreshIconAd;
- -(void)didLoadIconAd;
- -(void)didFailedToLoadIconAd;
Native Ad Events
- -(void) onNativeAdLoaded:(CAMediatedNativeAd*)nativeAd;
- -(void) onNativeAdLoadFailed;
- -(void) onNativeAdClicked;
- -(void) onNativeAdShown;
- -(void) onNativeAdFailToShow;
- -(void) onNativeAdClosed
Add/Remove Ad Networks
Admob
Add Admob Ad network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds Admob mediation SDK. And place the following files in your project:
libadmob-mediation.a UnifiedNativeAdView.xib GoogleMobileAds.framework GoogleAppMeasurement.framework GoogleMobileAds.framework GoogleUtilities.framework nanopb.framework
Note: If you are using Admob please make sure to add this key in info plist GADApplicationIdentifier and set its value to your admob APPID
Remove Admob Ad Network
Please remove the following files from you project:
libadmob-mediation.a UnifiedNativeAdView.xib GoogleMobileAds.framework GoogleAppMeasurement.framework GoogleMobileAds.framework GoogleUtilities.framework nanopb.framework
Unity Ads
Add Unity Ads Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds UnityAds mediation SDK. And place the following files in your project:
libunityads-mediation.a UnityAds.framework
Remove Unity Ads Ad network
Please remove the following files from you project:
libunityads-mediation.a UnityAds.framework
AdColony
Add Adcolony Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds AdColony mediation SDK. And place the following files in your project:
libadcolony-mediation.a AdColony.framework
Remove AdColony Ad Network
Please remove the following files from your project:
libadcolony-mediation.a AdColony.framework
Chartboost
Add Chartboost Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds Chartboost mediation SDK. And place the following files in your project:
libchartboost-mediation.a Chartboost.framework CHAMoatMobileAppKit.framework
Remove Chartboost Ad Network
Please remove the following files from you project:
libchartboost-mediation.a Chartboost.framework CHAMoatMobileAppKit.framework
IronSource
Add IronSource Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds IronSource mediation SDK. And place the following files in your project:
libironsource-mediation.a IronSource.framework
Remove IronSource Ad Network
Please remove the following files from you project:
libironsource-mediation.a IronSource.framework
Applovin
Add Applovin Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds Applovin mediation SDK. And place the following files in your project:
libapplovin-mediation.a AppLovinSDK.framework Native Ads Carousel applovin_card_learn_more.png applovin_card_muted.png applovin_card_play.png applovin_card_replay.png applovin_card_unmuted.png Star_Sprite_0.5.png Star_Sprite_1.5.png Star_Sprite_2.5.png Star_Sprite_3.5.png Star_Sprite_4.5.png Star_Sprite_5.png Star_Sprite_0.png Star_Sprite_1.png Star_Sprite_2.png Star_Sprite_3.png Star_Sprite_4.png
Remove Applovin Ad Network
Please remove the following files from you project:
libapplovin-mediation.a AppLovinSDK.framework Native Ads Carousel applovin_card_learn_more.png applovin_card_muted.png applovin_card_play.png applovin_card_replay.png applovin_card_unmuted.png Star_Sprite_0.5.png Star_Sprite_1.5.png Star_Sprite_2.5.png Star_Sprite_3.5.png Star_Sprite_4.5.png Star_Sprite_5.png Star_Sprite_0.png Star_Sprite_1.png Star_Sprite_2.png Star_Sprite_3.png Star_Sprite_4.png
Mopub
Add Mopub Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Embed the MoPub.xcframework by selecting target -> build phases ->Embed Framework
Go to ConsoliAds portal and download ConsoliAds Mopub mediation SDK. And place the following files in your project:
libmopub-mediation.a MPNativeVideoView.h MPNativeVideoView.m MoPub.xcframework
Remove Mopub Ad Network
Please remove the following files from you project:
libmopub-mediation.a MPNativeVideoView.h MPNativeVideoView.m MoPub.xcframework
StartApp
Add StartApp Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds StartApp mediation SDK. And place the following files in your project:
libstartapp-mediation.a StartApp.framework. StartApp.bundle. StartAppNativeAdView. Star_Sprite_0.5.png Star_Sprite_1.5.png Star_Sprite_2.5.png Star_Sprite_3.5.png Star_Sprite_4.5.png Star_Sprite_5.png Star_Sprite_0.png Star_Sprite_1.png Star_Sprite_2.png Star_Sprite_3.png Star_Sprite_4.png
Remove StartApp Ad Network
Please remove the following files from you project:
libstartapp-mediation.a StartApp.framework. StartApp.bundle. StartAppNativeAdView. Star_Sprite_0.5.png Star_Sprite_1.5.png Star_Sprite_2.5.png Star_Sprite_3.5.png Star_Sprite_4.5.png Star_Sprite_5.png Star_Sprite_0.png Star_Sprite_1.png Star_Sprite_2.png Star_Sprite_3.png Star_Sprite_4.png
Tapjoy
Add Tapjoy Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds Tapjoy mediation SDK. And place the following files in your project:
libtapjoy-mediation.a Tapjoy.embeddedframework
Remove Tapjoy Ad Network
Please remove the following files from you project:
libtapjoy-mediation.a Tapjoy.embeddedframework
Add Facebook Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Embed the FBAudienceNetwork.framework by selecting target -> build phases ->Embed Framework
Go to ConsoliAds portal and download ConsoliAds Facebook mediation SDK. And place the following files in your project:
libfacebook-mediation.a FBAudienceNetwork.framework FBSDKCoreKit. View.xib
Remove Facebook Ad Network
Please remove the following files from you project:
libfacebook-mediation.a FBAudienceNetwork.framework FBSDKCoreKit. View.xib
Kidoz
Add Kidoz Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds Kidoz mediation SDK. And place the following files in your project:
libkidoz-mediation.a KidozSDK.h libKidozSDK.a
Remove Kidoz Ad Network
Please remove the following files from you project:
libkidoz-mediation.a KidozSDK.h libKidozSDK.a
Vungle
Add Vungle Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds Vungle mediation SDK. And place the following files in your project:
libvungle-mediation.a Vungle.framework
Remove Vungle Ad Network
Please remove the following files from you project:
libvungle-mediation.a Vungle.framework
InMobi
Add InMobi Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds InMobi mediation SDK. And place the following files in your project:
libinmobi-mediation.a InMobiSDK. framework InMobiNativeAdView
Remove InMobi Ad Network
Please remove the following files from you project:
libinmobi-mediation.a InMobiSDK. framework InMobiNativeAdView
MyTarget
Add MyTarget Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds MyTarget mediation SDK. And place the following files in your project:
libmytarget-mediation.a MyTargetSDK. framework
Remove MyTarget Ad Network
Please remove the following files from you project:
libmytarget-mediation.a MyTargetSDK. framework
Mintegral
Add Mintegral Ad Network
Make sure that the latest ConsoliAds Mediation SDK is integrated in your iOS project.
Go to ConsoliAds portal and download ConsoliAds Mintegral mediation SDK. And place the following files in your project:
libmintegral-mediation.a MintegralNativeAdBase.h MTGNativeVideoView.m MTGNativeVideoView.h Mintegral.xib MTGSDK.framework MTGSDKInterActive.framework MTGSDKInterstitial.framework MTGSDKInterstitialVideo.framework MTGSDKReward.framework
Remove Mintegral Ad Network
Please remove the following files from you project:
libmintegral-mediation.a MintegralNativeAdBase.h MTGNativeVideoView.m MTGNativeVideoView.h Mintegral.xib MTGSDK.framework MTGSDKInterActive.framework MTGSDKInterstitial.framework MTGSDKInterstitialVideo.framework MTGSDKReward.framework
More Help Sources of Integration
ConsoliAds Sample Project:
You can download the sample project from https://portal.consoliads.com/download/iOS to see complete ConsoliAds integration already implemented for all ad formats.
Youtube Videos:
You can watch short integrations videos on your youtube channel, https://www.youtube.com/watch?v=nExp4zfb0xc, to further explore integrations with ConsoliAds.
ConsoliAds GitHub forum
If you are having any technical issues, you can visit https://github.com/teamconsoliads/sampleapp-IOS to view known issues, share problems and suggestions.