ConsoliAds Mediation Integration

You are here:
Estimated reading time: 9 min

Create App on Portal

Login to your ConsoliAds portal and go to Apps-> New App to create your native app.

Make sure that you have already created a brand to associate your app with. Import your app directly from the app store or create manually by providing all the required information and save, ConsoliAds will create your app with the following default placeholders:
•   Activity 1
•   Activity 2
•   Activity 3
•   Activity 4
•   Options A
•   Options B
•   About
•   Settings

Integrate ConsoliAds iOS Mediation

  1. Login to your ConsoliAds portal and download ConsoliAds-mediation for native iOS
  2. Place all of the files in your project root (all files are mandatory)
  3. Add all files in project except “libConfigureServer.out”
  4. 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 Target > link Binary with libraries add

1. libc++.1.tbd.
2. lbsqlite3.0.tbd

5. In project target‘s info, add “App Transport Security Settings” as follows:

6. To add your desired Ad Network to ConsoliAds mediation, please visit ‘Add/Remove Ad Network‘ section.

Initialize ConsoliAds iOS Mediation

  1. Import “ConsoliAdsMediation.h” and set up app’s name and bundle ID as follows:
[ConsoliAdsMediation sharedInstance].productName=@"Mediation iOS";
[ConsoliAdsMediation sharedInstance].bundleIdentifier=@"com.onsonliAds.nativeMediation";

2. Initialize ConsoliAds-Mediation as follows:

[[ConsoliAdsMediation sharedInstance] initializeWithUserConsent:true viewController:self];

User Consent
TRUE means user has provided the consent and will be shown personalized ads, whereas FALSE means user is not willing to see personalized ads. It is developer’s responsibility to get user consent and pass it above initialization call.
ViewController
The prevailing view controller upon initialization.

Interstitial Ad

•  Login to your ConsoliAds portal and go to Apps->Mediation-> (Your APP)->Placeholders & Ads
•  Add Interstitial and Video Ad slot as shown in the below figure:

Show Interstitial Ads
Once initialized, ConsoliAds mediation is ready to show ads. Make sure you have added Ad Network IDs in the portal for the corresponding app. Now show interstitial ad simply by the following code:
NOTE: Interstitial ads are not required to be requested and loaded separately.

[[ConsoliAdsMediation sharedInstance] showInterstitial:sceneIndex viewController:self];

This call requires the following mandatory parameters:
Scene Index
Integer value for the index of the scene for which you want to show the Interstitial ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.
ViewController
The prevailing ViewController showing the interstitial ad.

Rewarded Video Ad

•  Login to your ConsoliAds portal and go to Apps->Mediation-> (Your APP)->Placeholders & Ads
•  Add Rewarded Video Ad slot as shown in the below figure:

Load Rewarded Video
Rewarded video ads in ConsoliAds are loaded and shown separately. Load rewarded video ad as follows:

[[ConsoliAdsMediation sharedInstance] loadRewarded:sceneIndex];

NOTE: It is highly recommended that you call LoadRewarded(sceneIndex) as early as possible to allow videos to be preloaded.
This call requires the following mandatory parameters:
Scene Index
Integer value for the index of the Scene for which you want to load the Rewarded video ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.
Show Rewarded Video
Show Rewarded ad simply by the following code:

[[ConsoliAdsMediation sharedInstance]showRewardedVideo:sceneIndex viewController:self];

Scene Index
Integer value for the index of the scene for which you want to show the Rewarded Video ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.
ViewController
The prevailing ViewController when showing the rewarded video ad.

Banner Ad

•  Login to your ConsoliAds portal and go to Apps->Mediation-> (Your APP)->Placeholders & Ads
•  Add Banner Ad slot as shown in the below figure:

Show Banner
Show banner ad by simply the following code:

[[ConsoliAdsMediation sharedInstance]showBanner:sceneIndex viewController:self];

This call requires the following mandatory parameters:
Scene Index
Integer value for the index of the scene for which you want to show the banner ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.
ViewController
The prevailing ViewController when showing the banner ad.
NOTE: ConsoliAds mediation supports one banner per viewController

Native Ad

ConsoliAds provides the following approaches to show Native Ad:
Single Native Integration
Configure native ad for a single placeholder.
Multiple Native Integration
Multiple native ads from different Ad Networks in a Table View.

•  Login to your ConsoliAds portal and go to Apps->Mediation-> (Your APP)->Placeholders & Ads
•  Add Native Ad slot as shown in the below figure:

Show Single Native Ad
Single native ad integration lets you display and configure single Native Ad from following Ad Networks:

 Admob

To configure Admob Native Ad, following are the required parameters:

SceneIndex: the index of the placeholder & scene for which you want to configure Admob Native Ad

o View: Admob Native Ad will be rendered on this view

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureAdmobNativeAd:sceneIndex nativeAdPlaceholder:nativeAdPlaceholder viewController:self];

After calling the configure method you should call the following show method to Admob Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

  Facebook

To configure Facebook Native Ad, following are the required parameters:

o SceneIndex: the index of the placeholder & scene for which you want to configure Facebook Native Ad

o Social Context Label: this UILabel is required to display Native Ad social context text

o Ad Body Label: this UILabel is required to display Native Ad body text

o Ad Title Label: this UILabel is required to display Native Ad title text

o Sponsored Label: this UILabel is required to display Native Ad sponsored text

o Action Button: this UILabel is required to display Native Ad action button text

o Media View: this view will show the Native Ad content

o Ad Choice View: this view is for Native Ad choices view

o View: Native Ad will be rendered on this view

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureFacebookNativeAd:sceneIndex   adSocialContextLabel:_socialLabel adBodyLabel:_bodyLabel adTitleLabel:_adTitle   sponsoredLabel:_sponsoredLabel adUIView:_adUIView adActionButton:_adActionButton viewController:selfadIconView:_adIconView adCoverMediaView:_mediaView adChoicesView:_adChoicesView];

After calling the configure method you should call the following show method for Facebook Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

  ConsoliAds

To configure ConsoliAds Native Ad, following are the required parameters:

o SceneIndex: the index of the placeholder & scene for which you want to configure ConsoliAds Native Ad

o View: Admob Native Ad will be rendered on this view.

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureConsoliAdsNativeAd:sceneIndex nativeAdPlaceholder:nativeAdPlaceholder];

After calling the configure method you should call the following show method for ConsoliAds Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

  Applovin

To configure Applovin Native Ad, following are the required parameters:

o SceneIndex: the index of the placeholder & scene for which you want to configure Applovin Native Ad

o Rating Image View: this Image view is required to display Native Ad rating image View

o App Icon: this is required to display Native Ad App Icon Image view

o Ad Title Label: this UILabel is required to display Native Ad title text

o Description Label: this UILabel is required to display Native Ad description text

o Action Button: this is required to display Native Ad action button text

o Media View: this view will show the Native Ad content

o Container View: Native Ad will be rendered on this view.

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureApplovinNativeAdWithSceneIndex:sceneIndex ratingImageView:_rating appIcon:_appIcon titleLabel:_titleLabel descriptionLabel:_descriptionLabel ctaButton:_ctaButton mediaView:_mediaView adViewContainer:self.adViewContainer viewController:self];

After calling the configure method you should call the following show method for Applovin Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

  Leadbolt

To configure Leadbolt Native Ad, following are the required parameters:

o SceneIndex: the index of the placeholder & scene for which you want to configure Leadbolt Native Ad

o Container View: Native Ad will be rendered on this view.

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureLeadboltNativeAdWithSceneIndex:sceneIndex containerView:self.containerView viewController:self];

After calling the configure method you should call the following show method for Leadbolt Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

  StartApp

To configure StartApp Native Ad, following are the required parameters:

o SceneIndex: the index of the placeholder & scene for which you want to configure StartApp Native Ad

o Rating Image View: this Image view is required to display Native Ad rating image View

o Title Label: this UILabel is required to display Native Ad title text

o Description Label: this UILabel is required to display Native Ad description text

o Media View: this view will show the Native Ad content

o Container View: Native Ad will be rendered on this view

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureStartAppNativeAdWithSceneIndex:sceneIndex ratingImageView:_rating titleLabel:_titleLabel descriptionLabel:_descriptionLabel mediaView:_mediaImageView containerView:_containerView viewController:self];

After calling the configure method you should call the following show method for StartApp Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

  InMobi

To configure InMobi Native Ad, following are the required parameters:

o SceneIndex: the index of the placeholder & scene for which you want to configure InMobi Native Ad

o Icon Image View: this Image view is required to display Native Ad icon image

o Title Label: this UILabel is required to display Native Ad title text

o Content View: Native Ad content will be rendered on this view

o Container View: Native Ad will be shown on this view

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureInMobiNativeAdWithSceneIndex:sceneIndex iconImageView:_iconImageView titleLabel:_titleLabel contentView:_contentView adViewContainer:_containerView viewController:self];

After calling the configure method you should call the following show method for InMobi Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

  MobFox

To configure Mobfox Native Ad, following are the required parameters:

o SceneIndex: the index of the placeholder & scene for which you want to configure Mobfox Native Ad

o Icon Image View: this Image view is required to display Native Ad icon

o Native Ad Image View: this is required to display Native Ad image

o Native Ad Title: this UILabel is required to display Native Ad title text

o Native Ad Description Label: this UILabel is required to display Native Ad description text

o Container View: Native Ad will be rendered on this view

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureMobfoxNativeAdWithSceneIndex:sceneIndex nativeAdIcon:_iconImageView nativeAdImage:_ImageView nativeAdTitle:_titleLabel nativeAdDescription:_discriptionLabel adViewContainer:_containerView viewController:self];

After calling the configure method you should call the following show method to MobFox Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

  Mopub

To configure Mopub Native Ad, following are the required parameters:

o SceneIndex: the index of the placeholder & scene for which you want to configure Mopub Native Ad

o Container View: Native Ad will be rendered on this view

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureMopubNativeAdWithSceneIndex:sceneIndex adViewContainer:_containerView viewController:self];

After calling the configure method you should call the following show method to Mopub Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

  MyTarget

To configure MyTarget Native Ad, following are the required parameters:

o SceneIndex: the index of the placeholder & scene for which you want to configure MyTarget Native Ad

o Container View: Native Ad will be rendered on this view

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureMyTargetNativeAdWithSceneIndex:sceneIndex adViewContainer:_containerView viewController:self];

After calling the configure method you should call the following show method to MyTarget Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

  Mintegral

To configure Mintegral Native Ad, following are the required parameters:

o SceneIndex: the index of the placeholder & scene for which you want to configure Mintegral Native Ad

o Container View: Native Ad will be rendered on this view

o App Name Label: this UILabel is required to display Native Ad app name text

o App Description Label: this UILabel is required to display Native Ad description text

o Icon Image View: this Image view is required to display Native Ad icon

o Action Button: this UILabel is required to display Native Ad action button text

o Media View: this view will show the Native Ad content

o Ad Choice View: this view is required for Native Ad AdChoices view

o ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAdsMediation sharedInstance] configureMintegralNativeAdWithSceneIndex:sceneIndex contentView:self.containerView appNameLabel:self.appName appDescLabel:self.descLabel iconImageView:self.image adCallButton:self.adCallButton MGMediaView:self.mtgView adChoicesView:self.adChoices viewController:self];

After calling the configure method you should call the following show method to Mintegral Native Ad:

[[ConsoliAdsMediation sharedInstance] ShowNativeAd:sceneIndex viewController:self];

Destroy Native Ads

[[ConsoliAdsMediation sharedInstance] onDestroyForNativeAd:sceneIndex];

Callbacks for Native Ads

1. – (void)onNativeAdLoaded:(int)adNetworkName forIndex:(int)index;
2. – (void)onNativeAdFailedToLoad:(int)adNetworkName forIndex:(int)index;

Load Multiple Native Ads

Load native ads:

[[ConsoliAdsMediation sharedInstance]addNativeAd:sceneIndex];

Scene Index: Integer value for the index of the scene for which you want to show the Native ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.
Note: To load multiple native ads on the same scene, call the above method multiple times.

Native Ad Loaded Callback

Your viewController needs to implement the protocol “ConsoliAdsMediationDelegate” to receive callbacks.

Following callback is invoked when Native ad is loaded:

- (void)onNativeAdLoaded:(int)adNetworkName forIndex:(int)index;

adNetworkNameEnum for ad type

index:index of the ad (index for the first addNativeAd call would be 1 and would be 2 for the next call)

Get Native Ad

Get the native Ad for a specific Index:

[ConsoliAdsMediation sharedInstance]getNativeAdSceneIndex:(int) atIndex:(int)];

Scene Index 
Integer value for the index of the scene for which you want to show the Native ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.

atIndex:
Integer value for the index of the ad which you want to get Native ad. To use Typecast the object returned by getNativeAdAtIndex and check for nil as follows:

NativeAdBase  * nativeAd = (NativeAdBase  *)[[ConsoliAdsMediation sharedInstance]     getNativeAdSceneIndex:(int) atIndex:(int)];

if(nativeAd != nil){//populate native ad components here}

Native Ad Failure Callback

- (void)onNativeAdFailedToLoad:(int)adNetworkName forIndex:(int)index;

Icon Ad

Icon ad comes in different sizes (Small, Medium, Large)
Login to your ConsoliAds portal and go to Apps->Mediation->(Your APP)->Placeholders & Ads
Import IconAdBase.h and IconAdView.h
Add icon ad slot

 

Steps to show Icon Ad

Get Icon Ad:

IconAdBase *iconBase = (IconAdBase*)[[ConsoliAdsMediation sharedInstance] getIconAd:sceneIndex];

Show Icon Ad:

If( iconAdBase != nil ) { IconAdView *view = [[IconAdView alloc]initWithAd:iconBase]; [self.iconView addSubview:view]; }

iconView: This is the view at which you want to display Icon Ad.

Events Callbacks

ConsoliAds provides the following callbacks for different events.

- (void)onConsoliAdsInitializationSuccess:(BOOL)status;
- (void)onInterstitialAdShown;
- (void)onInterstitialAdClicked;
- (void)onVideoAdShown;
- (void)onVideoAdClicked;
- (void)onRewardedVideoAdShown;
- (void)onIconAdShown;
- (void)onRewardedVideoAdCompleted;
- (void)onRewardedVideoAdClick;
- (void)onNativeAdLoaded:(int)adNetworkName forIndex:(int)index;
- (void)onNativeAdFailedToLoad:(int)adNetworkName forIndex:(int)index;

Configure Server

Steps to Configure Server:

Find “libConfigureServer.out” in ConsoliAds-mediation package and place it in the root directory of the project.
Open terminal, change the directory path to the project root directory and run the following command.

./libConfigureServer.out userSignature packageName store Apple

Example:

./libConfigureServer.out 5d4b02b39dc419548ea8183e8d3ea170 com.seasonapps.myfitnessguide Apple

User Signature: A user identification code which is present in the personal info tab of your account.

Once you have successfully configured server, make sure to remove the libConfigureServer.out from root directory of the project

ConsoliAds GitHub Forum

If you are having any technical issues with ConsoliAds you can visit https://github.com/teamconsoliads/sampleapp-IOS to view known issues, share problems and suggestions.

Was this article helpful?
Dislike 1
Views: 240