inmobi-ad-tracker-iat | Audience Bidding for MoPub (iOS)

Prerequisites

  • The following environments are required:
    • iOS 9+
    • XCode 11

Step 1: Integrating the SDK


  • Step 1.1: Download the InMobi SDK

Download the latest InMobi SDK below. We also provide the option to use CocoaPods!

a. Direct SDK download here.

The SDK bundle contains all media adapters that we support. Prune the downloaded folder to retain the media adapters you need.

b. CocoaPods (Recommended)

In the same directory as your YOUR_PROJECT.xcodeproj, create an empty file named Podfile and copy and paste the following:

platform :ios, '9.0'
target 'APP_NAME' do
      pod ‘InMobiABMoPubPlugin’
end
	

Note: If you want to integrate InMobiSDK without moat Libraries:

pod 'InMobiABMoPubPlugin/Core'
	

Ensure your project has been closed. Using the terminal, navigate to the directory containing the Podfile and run the command: pod install. Once the installation finishes, use YOUR_PROJECT.xcworkspace to access your project moving forward.

Inside the xcworkspace there should be a Pods directory included with a ios-sdk-pod sub-directory.

Warning: Please remove all older versions of the InMobi SDK (8.X.X and older) and all older versions of the AerServ SDK. Otherwise, your code will not compile! Please reach out to your account manager if you have any questions. If you are using CocoaPods, be sure to remove the 'aerserv-ios-sdk' pod from your podfile and only use the 'InMobiMediationSDK' pod.

  • Step 1.2: Add the Required Libraries

Add the following frameworks into your project from the InMobi SDK download:

  • InMobiSDK.framework
  • InMobiMediationSDK.framework
  • INMMoatMobileAppKit.framework from the downloaded InMobi iOS SDK bundle (optional)

Note: When using any mediation through the InMobi SDK, it is highly recommended that you use the framework that is provided along with the InMobi SDK download. These versions have been tested by our team and using any other version may not be officially supported.

  • Step 1.3: General Settings

  • Under the General tab within your project's target, you'll need to add the following settings:
  • Select all Device Orientation inside 'Deployment Info'.
  • Add the following dependencies to Linked Frameworks and Libraries:
    • WebKit.framework
    • libxml2..tbd
    • libz.tbd
    • libsqlite.3.0.tbd

One or more of the mediation adapters that you selected requires these frameworks. For the SDKs to work properly, you MUST include these frameworks into your project.

  • Step 1.4: Create a bridging header (Swift Only)

You will need to create a bridging header if your application is built with Swift. The bridging header exposes the Objective-C implementation to Swift. To create the bridging header, you'll need to do the following:

  1. Create a new header file, InMobiSDK-Bridging-Header.h.
  2. Add the following entry to the Bridging Header:
    #import <InMobiSDK/InMobiSDK.h>
    		
  3. Add the newly created header file's path to the target's Build Setting -> Linking -> Objective-C Bridging Header
  • Step 1.5: Build Settings

Add the following flags to the target's Build Setting -> Linking -> Other Linker Flag:

-ObjC

  • Step 1.6: Info.plist

You will need to add the following entries into your info.plist:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Location is used to help target content to your general area</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Some ad content may require access to the photo library.</string>
<key>NSCameraUsageDescription</key>
<string>Some ad content may access camera to take picture.</string>
	

For iOS 9+, you will need to disable App Transport Security (ATS). Please refer here for more detail.

Step 1.7.1: Audience Bidding

Note: Contact your account manager for Audience Bidding placement setup.

To use the InMobi Audience Bidding SDK, here is how you can expect the flow to go:

  • The InMobi Audience Bidder SDK will make an ad request and return a bid object
  • The bid object from InMobi Audience Bidder will have an updated MoPub Ad Object and have pricing keywords attached
  • You then call loadAd() on the MoPub ad object as before
  • If InMobi is selected to fill, The InMobi Audience Bidder SDK will handle the rendering

Optionally, if you would like to handle the keywords yourself, you may also observe the below flow:

  • The InMobi Audience Bidder SDK will make an ad request.
  • The response from InMobi Audience Bidder will have an IMABBidResponse object
  • You may query the object for the bid keyword, price, granular keyword, InMobi placement, and buyer
  • You would then append the bid keyword to MoPub's AdView
  • You would then call loadAd() on the MoPub ad object as before
  • If InMobi is selected to fill, The InMobi Audience Bidder SDK will handle the rendering


  • Option 1: Add the additional following framework file:

You can find this file in the following directory: dist/network-support/MoPub/

InMobiABMoPubPlugin.framework
	

If you are updating your iOS SDK version from a prior version, ensure that you've updated all of these files. Otherwise, if this is your first time integrating, just ensure that you link these files in your project.

  • Option 2: Update your podfile

Add the pod “InMobiABMoPubPlugin" to your podfile.

platform :ios, '9.0'
target 'APP_NAME' do
      pod ‘InMobiABMoPubPlugin’
end
	
Step 1.7.1.1 Audience Bidding Setup on MoPub

To enable Audience Bidding, you will need to do 2 things:

  1. Set up the line item to use the specific keywords with pricing and implement the new AerServ + InMobi bidder class.
  2. Update your existing MoPub implementation.
  • Step 1.7.1.1.1 Setting up the MoPub Line Items
Option 1 (Setting up Line Items Manually)
  1. Click on Orders -> Create Order
  2. Create a new order
    • Give your order a name (ex. Audience_Bidding_Test)
    • Enter in an advertiser name (ex. InMobi)
  3. Line item type
    • Give your line item a name (ex.IMAB_Banner_0.50)
    • Select type: Network Line Item
    • Select Network: Custom SDK network
    • Custom event class:
      • Banner: IMABCustomEventBanner
      • Interstitial: IMABCustomEventInterstitial
    • Custom event data: {}
    • Under "Budget & schedule", please enter the rate that matches what you have set up on your InMobi + AerServ dashboard for your eCPM (ex. 0.50)
  4. Ad unit targeting
    • Select the app and ad unit for your line item
  5. Audience Targeting
    Enter the keyword in the "Keyword targeting" in this format IMAB:0.00 (ex. IMAB:0.50)

    eCPM

    Keyword

    eCPM

    Keyword

    0.01 IMAB:0.01 5.00 IMAB:5.00
    0.05 IMAB:0.05 6.00 IMAB:6.00
    0.10 IMAB:0.10 7.00 IMAB:7.00
    0.20 IMAB:0.20 8.00 IMAB:8.00
    0.30 IMAB:0.30 9.00 IMAB:9.00
    0.40 IMAB:0.40 10.00 IMAB:10.00
    0.50 IMAB:0.50 11.00 IMAB:11.00
    0.60 IMAB:0.60 12.00 IMAB:12.00
    0.70 IMAB:0.70 13.00 IMAB:13.00
    0.80 IMAB:0.80 14.00 IMAB:14.00
    0.90 IMAB:0.90 15.00 IMAB:15.00
    1.00 IMAB:1.00 16.00 IMAB:16.00
    1.10 IMAB:1.10 17.00 IMAB:17.00
    1.20 IMAB:1.20 18.00 IMAB:18.00
    1.30 IMAB:1.30 19.00 IMAB:19.00
    1.40 IMAB:1.40 20.00 IMAB:20.00
    1.50 IMAB:1.50 21.00 IMAB:21.00
    1.60 IMAB:1.60 22.00 IMAB:22.00
    1.70 IMAB:1.70 23.00 IMAB:23.00
    1.80 IMAB:1.80 24.00 IMAB:24.00
    1.90 IMAB:1.90 25.00 IMAB:25.00
    2.00 IMAB:2.00 26.00 IMAB:26.00
    2.50 IMAB:2.50 27.00 IMAB:27.00
    3.00 IMAB:3.00 28.00 IMAB:28.00
    3.50 IMAB:3.50 29.00 IMAB:29.00
    4.00 IMAB:4.00 30.00 IMAB:30.00
  6. Click "Save"
Option 2 (Setting up Line Items with an Automated Script

Add a Chrome extension to your browser.

  1. Login to the MoPub Dashboard
  2. Create your order
  3. Create the first line item under the order
    • Line Item Setup:
      • Type & Priority: Network Line Item
      • Network: Custom SDK Network
      • Custom Event Class:
        • Banner: IMABCustomEventBanner
        • Interstitial: IMABCustomEventInterstitial
      • Example
      • Under the "Audience Targeting" section:
        • Please enter a keyword in this format: IMAB:0.01
        • Example
      • Staying on the current tab, open the extension.
      • Input the order name and the first line item name
      • Click 'Run' to execute
      • Wait for all the line items to be created
Step 1.7.1.1.2 Technical Integration Details for Audience Bidding

For Audience Bidding, here are the required changes that you'll need to do in our code:

  • Integration Step 1: Import the InMobi SDK

The IMAudienceBidder is a part of the SDK and will be able to handle most of the functionality required for audience bidding.

#import <InMobiSDK/InMobiSDK.h>
	
  • Integration Step 2: Initialize the MoPub SDK

Remember to initialize the MoPub SDK. If you don't initialize, your application may not work as intended.

MPMoPubConfiguration *sdkConfig = [[MPMoPubConfiguration alloc] initWithAdUnitIdForAppInitialization:@"AD_UNIT_ID"];	
[[MoPub sharedInstance] initializeSdkWithConfiguration:sdkConfig completion:nil]
	

Please Note: Make sure that your implementation uses MoPub's init SDK method if you are using a version of MoPub that supports it. You can consult their docs here for more information: https://developers.mopub.com/publishers/ios/initialize/

  • Integration Step 3: Initialize InMobi Audience Bidder

You MUST initialize the InMobi Audience Bidder before you make an ad request. Typically, the initialization step may take up to 10 seconds. The initialize method will take in your application site ID (from the InMobi platform). If you have problems finding this information, reach out to your account manager.

Note: To set the General Data Protection Regulation (GDPR) user consent flag. Pass YES/true for user consent if GDPR user consent was granted and NO/false if user consent was denied or if unknown. Pass IAB consent string in the key IM_GDPR_CONSENT_KEY. The string must follow the IAB contracts as mentioned here

[IMAudienceBidder initializeWithAppID:kASAppID andUserConsent:@{ IM_GDPR_CONSENT_AVAILABLE : “TRUE”, IM_GDPR_CONSENT_IAB : “iabConsentString” }];
	

Note:
If you would like for InMobi to handle keywords (thus simplifying your integration), follow the below steps for Option A.
If you would like to handle the keywords yourself instead, you may instead follow the steps for Option B. In addition, you will have to call setLocalExtras on the MoPub ad view.

  • Integration Step 4: Create or Submit a Bid

For Option A, to easily support banner refresh and support subsequent ad requests to the InMobi Audience Bidder, we have a BidObject that you should use. The IMAudienceBidder methods will return a BidObject which you can then call our refreshBid on.

The +createBidForAdType: method will return a bidObject which you should retain a strong reference to.

@property (strong, nonatomic) IMBidObject *bidObject;
	

For Option B, you will not be able to use the BidObject, and you will have to repeatedly call the + submitBidForAdType: method.

    • Option A: Make an ad request using the bid object
      • The +createBidForAdType method requires for you to pass in an adType, InMobi placement (PLC), MoPub Ad View, and delegate. Contact your InMobi account manager if you have any questions about this.
      • The adType ENUM: kIMBiddingAdTypeBanner, kIMBiddingAdTypeInterstitial
      • The setBannerSlotSize:adSize method will use to set the banner size. By default banner size will be 320*50.
      • The +submitBid method will kick off the bidding process with the created bid object. You may review IMAudienceBidder.h for more information.
    • Option B: Submit a bid request using submitBidForAdType
      • The +submitBidForAdType method requires for you to pass in an adType, InMobi placement (PLC), and delegate. Contact your InMobi account manager if you have any questions about this.
      • The adType ENUM: kIMBiddingAdTypeBanner, kIMBiddingAdTypeInterstitial
      • The +submitBidForAdType method also will kick off the bidding process (no need to call +submitBid seperately).You may review IMAudienceBidder.h for more information.

A full example snippet for banner and interstitial is available below.

Banner Code Examples

Option A: InMobi will handle the keywords for you in this snippet.

self.adView = [[MPAdView alloc] initWithAdUnitId:MP_BANNERID size:MOPUB_BANNER_SIZE];
self.adView.frame = CGRectMake((self.view.bounds.size.width - MOPUB_BANNER_SIZE.width) / 2, self.view.bounds.size.height - (MOPUB_BANNER_SIZE.height), MOPUB_BANNER_SIZE.width,MOPUB_BANNER_SIZE.height);
[self.view addSubview:self.adView];
self.adView.delegate = self;
// Call createBidForAdType and retain a reference to the bid object to be utilized later
self.bannerBidObject = [IMAudienceBidder createBidForAdType:kIMBiddingAdTypeBanner withPlacement:AS_BannerID_AB adObj:self.adView andDelegate:self];
// Set the banner ad size
[self.bannerBidObject setBannerSlotSize:MOPUB_BANNER_SIZE];
// Submit the bid to kick off the bidding process
[self.bannerBidObject submitBid];
	

Option B: You will handle the keywords in this example. Call submitBidForAdType and do not use a bid object.

self.adView = [[MPAdView alloc] initWithAdUnitId:MP_BANNERID size:MOPUB_BANNER_SIZE];
self.adView.frame = CGRectMake((self.view.bounds.size.width - MOPUB_BANNER_SIZE.width) / 2, self.view.bounds.size.height - (MOPUB_BANNER_SIZE.height), MOPUB_BANNER_SIZE.width,MOPUB_BANNER_SIZE.height);
[self.view addSubview:self.adView];
self.adView.delegate = self;
// Call submitBidForAdType if you plan to add keywords to the object yourself
[IMAudienceBidder submitBidForAdType:kIMBiddingAdTypeBanner withPlacement:AS_BannerID_ABadSize:MOPUB_BANNER_SIZE andDelegate:self];
	

Remember to add the banner to the view and call show on it once you get the bidReceived delegate callback. For more information about MoPub banner implementation, you can consult the relevant MoPub documentation here: https://developers.mopub.com/docs/ios/banner/

Interstitial Code Examples

Option A: InMobi will handle the keywords for you in this snippet.

self.interstitial = [MPInterstitialAdControllerinterstitialAdControllerForAdUnitId:MP_INTERSTITIALID];
self.interstitial.delegate = self;
// Call createBidForAdType and retain a reference to the bid object to be utilized later
self.interstitialBidOBject = [IMAudienceBiddercreateBidForAdType:kIMBiddingAdTypeInterstitial withPlacement:AS_InterstitialID_ABadObj:self.interstitial andDelegate:self];
// Submit the bid to kick off the bidding process
[self.interstitialBidOBject submitBid];
	

Option B: You will handle the keywords in this example. Call submitBidForAdType and do not use a bid object.

self.interstitial = [MPInterstitialAdControllerinterstitialAdControllerForAdUnitId:MP_INTERSTITIALID];
self.interstitial.delegate = self;
// Call submitBidForAdType if you plan to add keywords to the object yourself
[IMAudienceBidder submitBidForAdType:kIMBiddingAdTypeInterstitial withPlacement:AS_InterstitialID_AB andDelegate:self];
	

Remember to then call load on the interstitial once you get the bidReceived delegate callback. You can reference the section below as well to see an example. For more information about MoPub interstitial implementation, you can consult the relevant MoPub documentation here: https://developers.mopub.com/docs/ios/interstitial/

Also, do remember to call show when the interstitial has loaded! (when you get the interstitialDidLoadAd delegate callback from MoPub)

  • Integration Step 5: Implement the IMAudienceBidderDelegate Interface

Option A: The IMAudienceBidderDelegate has 2 methods that need to be implemented:

  • -audienceBidderDidReceiveBidFor:
  • -audienceBidderDidFailBidFor:

In either scenario (banner or interstitial), you will be returned a MPAdView for banner or MPInterstitialAdController for interstitial. If a bid was returned from createBidForAdType, you would then be given an updated MoPub Ad object. If a bid was not returned from createBidForAdType, you get returned a reference of the MoPub ad object with unmodified keywords. Below is an example delegate implementation covering both banner and interstitial:

// Use a Boolean to keep track so you don't call loadAd on the banner repeatedly. 
Boolean bannerLoaded = false;
- (void)audienceBidderDidFailBidFor:(id)adObject withError:(NSError *error {
  // If the returned and updated adObject is a banner:
  if([adObject isKindOfClass:[MPAdView class]]) {
      // If the banner has not yet been loaded, call loadAd on the updated ad view
      if (!bannerLoaded){
          [self.adView loadAd];
      }
  }
  // If the returned adObject is an interstitial:
  else if([adObject isKindOfClass:[MPInterstitialAdController class]]) {
      [adObject loadAd];
  }
}
- (void)audienceBidderDidReceiveBidFor:(id)adObject {
  // If the returned and updated adObject is a banner:
  if([adObject isKindOfClass:[MPAdView class]]) {
      // If the banner has not yet been loaded, call loadAd on the updated MoPub Ad View
      if (!bannerLoaded){
          [adObject loadAd];
      }
  }
  // If the returned adObject is an interstitial:
  else if([adObject isKindOfClass:[MPInterstitialAdController class]]) {
      [adObject loadAd];
  }
}
	

Option B: If you prefer to handle keywords yourself, the IMAudienceBidderDelegate has 2 methods that need to be implemented:

  • -audienceBidderDidGenerateBidResponse:
  • -audienceBidderDidFailBidFor:

For this method, you will have to set the kIMABLocalCacheKey in the localExtras of the respective adview / interstitial. In addition, you may be returned a IMBidResponse object. You may access the follow properties on the object:

  • NSString* placement - A NSString that describes the InMobi placement
  • NSString* buyer - A NSString that describes the buyer
  • NSNumber* price - A NSNumber that describes the price
  • NSString* keyword - A NSString that describes a keyword that should be provided to the MoPub ad object
  • NSString* higherGranularityKeyword - A NSString that describes a granular keyword

In either scenario (banner or interstitial), if a bid was returned from submitBidForAdType, you would then be given a IMBidResponse object. If a bid was not returned from submitBidForAdType, you do not get returned an IMBidResponse object and you can choose to add additional keywords at this step and/or call loadAd. Below is an example delegate implementation covering both banner and interstitial:

// Use a Boolean to keep track so you don't call loadAd on the banner repeatedly. 
Boolean bannerLoaded = false;
- (void)audienceBidderDidGenerateBidResponse:(IMBidResponse *)bidResponse {
  // If the bid response placement is a banner
  if (bidResponse.placement == AS_BannerID_AB) {
      // Set or append the returned InMobi bidResponse keywords on the adView
      [self.adView setKeywords:bidResponse.keyword];
      // Set the local extras of the adview
      self.adView.localExtras = @{kIMABLocalCacheKey : bidResponse.placement};
      // If the banner has not yet been loaded, call loadAd on the updated MPAdView
      if (!bannerLoaded){
          [self.adView loadAd];
      }
  } else if (bidResponse.placement == AS_InterstitialID_AB) {
      // Set or append the returned InMobi bidResponse keywords on the interstitial
      [self.interstitial setKeywords:bidResponse.keyword];
      // Set the local extras of the interstitial
      self.interstitial.localExtras = @{kIMABLocalCacheKey : bidResponse.placement};
      [self.interstitial loadAd];
  }
}
	
  • Integration Step 6: Implement Banner Callbacks to Support Banner Refresh with a New Bid

We support MoPub's automatic banner refresh in the InMobi Audience Bidder SDK for both implementation options, A and B.

Option A: You'll need to include an +submitBid method call in the MoPub adViewDidLoadAd / adViewDidFailToLoadAd delegate callbacks. This will allow us to provide a fresh bid each time the banner is refreshed.

Note: The submitBid method should only be called after the banner bid object has been constructed to avoid unexpected behavior.

- (void)adViewDidLoadAd:(MPAdView *)view {
// Ensure that you do not call loadAd again on the MoPub Ad View
bannerLoaded = true;
// On a successful load, call submitBid for the next refresh
[self.bannerBidObject submitBid];
}
- (void)adViewDidFailToLoadAd:(MPAdView *)view {
// Ensure that you do not call loadAd again on the MoPub Ad View
bannerLoaded = true;
// On a failed load, still call submitBid for the next banner refresh
[self.bannerBidObject submitBid];
}
	

Option B: You'll need to include a new +submitBidForAdType method call in the MoPub adViewDidLoadAd / adViewDidFailToLoadAd delegate callbacks. This will allow us to provide a fresh bid each time the banner is refreshed.

- (void)adViewDidLoadAd:(MPAdView *)view {
// Ensure that we do not call loadAd again on the MPAdView
bannerLoaded = true;
// On a successful load, do a new submitBidForAdType for the next refresh
[IMAudienceBidder submitBidForAdType:kIMBiddingAdTypeBanner withPlacement:AS_BannerID_AB adSize:MOPUB_BANNER_SIZE andDelegate:self];
}
- (void)adViewDidFailToLoadAd:(MPAdView *)view {
// Ensure that we do not call loadAd again on the MPAdView
bannerLoaded = true;
// On a failed load, still call submitBidForAdType for the next banner refresh
[IMAudienceBidder submitBidForAdType:kIMBiddingAdTypeBanner withPlacement:AS_BannerID_AB adSize:MOPUB_BANNER_SIZE andDelegate:self];     
}
	
  • Integration Step 7: Get a New Interstitial Bid

Option A: After an interstitial is shown, you can optionally call 'submitBid' on the interstitial bid object to get a new bid from the InMobi Audience Bidder.

Note: The submitBid method should only be called after the interstitial bid object has been constructed to avoid unexpected behavior.

[self.interstitialBidOBject submitBid];
	

Option B: After an interstitial is shown, you can optionally call 'submitBidForAdType' on to get a new bid from the InMobi Audience Bidder.

[IMAudienceBidder submitBidForAdType:kIMBiddingAdTypeInterstitial withPlacement:AS_InterstitialID_AB andDelegate:self];
	
  • Step 1.7.1.1.3: Testing your Audience Bidding Integration

In order to test your Audience Bidding implementation, you will need to:

  • Make sure you enable test mode on your placement through the UI
  • Set up a line item with
    • CPM 0.00
    • Keyword: IMAB:0.00
  • Two ways to verify:
    • Through Charles:
      • In the ad request we send to Mopub (ads.mopub.com/m/ad), check under "Contents" & "JSON Text".

        You should see a key value pair of: "q: keywords, testing, IMAB:0.00"

    • Through Mopub Reporting:
      1. Make sure the ad filled on testing
      2. Make sure the numbers align for the newly generated line item at $0.00 (it might take a few minutes for Mopub to report it).

Step 1.7.2: Non-audience Bidding

  • Step 1.7.2.1: Add the MoPub to AerServ Adapter
    • Add the following files from dist/network-support/MoPub/AerServCustomEvents to your project:
      • network-support/MoPub/AerServCustomEvents/AerServBidListener.h
      • network-support/MoPub/AerServCustomEvents/AerServBidObject.h
      • network-support/MoPub/AerServCustomEvents/AerServBidObject.m
      • network-support/MoPub/AerServCustomEvents/AerServBidder.h
      • network-support/MoPub/AerServCustomEvents/AerServBidder.m
      • network-support/MoPub/AerServCustomEvents/AerServCustomEventBanner.m
      • network-support/MoPub/AerServCustomEvents/AerServCustomEventInterstitial.m
      • network-support/MoPub/AerServCustomEvents/AerServCustomEventRewardedInterstitial.m
  • Step 1.7.2.2: Configure Ad Setting on MoPub Dashboard
    1. (Optional) Create a new AdUnit with the ad type that you'll like to use AerServ with. You can use an existing AdUnit if one already exists.
    2. Now go to the 'Orders' tab and click on Create order. Creating a new 'Order' is optional. You can use an existing order if one already exists. If you decide to use an existing order, you will need to create a new Line Item instead.
    3. When creating a new Order/ Line Item, use the following parameters:
      • Advertiser: AerServ
      • Type & Priority: Network
      • Network: Custom Native Network
      • Class: Use one of the following class name
        • For banner: AerServCustomEventBanner
        • For interstitial: AerServCustomEventInterstitial
        • For rewarded video: AerServCustomEventRewardedInterstitial
      • eCPM: You will need to use the eCPM from the AerServ dashboard. If you have any questions please contact our support.
      • Data: AerServ ad parameters, in JSON format. This field will take any additional parameters for the AerServ SDK. Refer to Advance Topics - Server Parameters for more information.
      • Select the newly created AdUnit created or use existing a AdUnit
  • Step 1.7.2.3: AerServ Ad Parameter
    AerServ server ad parameters that you entered on MoPub's web interface must be in JSON format. Currently we support these parameters:
    NAME TYPE REQUIRED DEFAULT DESCRIPTION
    placement String Yes N/A AerServ Placement
    Sample AerServ Ad Parameter
    {"placement": "1000741"}
    		
  • Step 1.7.2.4: Event Mapping

    AerServ banner events are mapped to MoPub's MPAdViewDelegate events, as follows:

    • -adViewDidLoadAd:-bannerCustomEvent:didLoadAd:
    • -adViewDidFailToLoadAd:withError:-bannerCustomEvent:didFailToLoadAdWithError:
    • -willLeaveApplicatonFromAd:-bannerCustomEventWillLeaveApplication:
    • -adWasClicked:-bannerCustomEventWillBeginAction:
    • -didDismissModalViewForAd:-bannerCustomEventDidFinishAction:

    AerServ interstitial events are mapped to MoPub's MPInterstitialAdControllerDelegate events, as follows:

    • -interstitialViewControllerDidPreloadAd:-interstitialCustomEvent:didLoadAd:
    • -interstitialViewControllerAdFailedToLoad:withError:-interstitialCustomEvent:didFailToLoadAdWithError:
    • -interstitialViewControllerWillDisappear:-interstitialCustomEventWillDisappear:
    • -interstitialViewControllerDidDisappear:-interstitialCustomEventDidDisappear:
    • -interstitialViewControllerWillAppear:-interstitialCustomEventWillAppear:
    • -interstitialViewControllerDidAppear:-interstitialCustomEventDidAppear:
    • -interstitialViewControllerAdWasTouched-interstitialCustomEventDidReceiveTapEvent:

    AerServ rewarded video events are mapped to MoPub's MPRewardedVideoAdManagerDelegate events, as follows:

    • -interstitialViewControllerDidPreloadAd-rewardedVideoDidLoadAdForCustomEvent:
    • -interstitialViewControllerAdFailedToLoad:withError:-rewardedVideoDidFailToLoadAdForCustomEvent:error:
    • -interstitialViewControllerWillDisappear: → -rewardedVideoWillDisappearForCustomEvent
    • -interstitialViewControllerDidDisappear:-rewardedVideoDidAppearForCustomEvent:
    • -interstitialViewControllerWillDisappear:-rewardedVideoWillAppearForCustomEvent:
    • -interstitialViewControllerDidAppear:-rewardedVideoWillAppearForCustomEvent:
    • -interstitialViewControllerAdWasTouched:-rewardedVideoDidReceiveTapEventForCustomEvent:
    • -interstitialViewControllerDidVirtualCurrencyReward:vcData:-rewardedVideoShouldRewardUserForCustomEvent:reward:

Step 2: Additional Settings

  • Step 2.1: Disabling App Transport Security for iOS 9+

    Select your application's Info.plist, right-click on it and open as source code. Copy the following code into your Info.plist's xml.

    <key>NSAppTransportSecurity</key>
    <dict>
      <key>NSAllowsArbitraryLoads</key> <true/>
    </dict>
    		
  • Step 2.2: iOS 12 Wifi Settings

    Step 2.2.1: Enable XCode WiFi Settings

    From iOS 12 onwards, Apple has introduced privacy settings to access WiFi details. If the publisher decides to share wifi details, they can take advantage of targeted ads. Benefits of ad targeting are that, the ads are more useful and meaningful to users.

    How to enable Access Wifi Information

    1. Enable access WiFi information feature to your App ID.

    2. Enable access WiFi information feature for your target app from XCode capabilities.

    3. WiFi Access should get added to your App.entitlements file. If not please add the following code to your App.entitlements file.
      <dict>
          <key>com.apple.developer.networking.wifi-info</key>
          <true/>
      </dict>
      			

  • Step 2.2.2: AVAudioSession event changes in WKWebView

    WKWebView ignores AVAudioSessionCategory, Publisher can handle audio interruptions by registering to observe AVAudioSessionInterruptionnotification posted by AVAudioSession. Publisher should ensure minimum possible disruption, and the most graceful possible recovery, from the perspective of the user.


  • Step 2.2.3: Observing Audio Interruptions

    To handle audio interruptions, begin by registering to observe notifications of type AVAudioSessionInterruptionNotification.


  • - (void)registerForAudioInterruptionNotification {
        AVAudioSession *audioSession = [AVAudioSession sharedInstance];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAudioSessionInterruption:) name:AVAudioSessionInterruptionNotification object:audioSession];
    }
    - (void)handleAudioSessionInterruption:(NSNotification *)notification {
        NSNumber *interruptionType = [[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey];
        NSNumber *interruptionOption = [[notification userInfo] objectForKey:AVAudioSessionInterruptionOptionKey];
        switch (interruptionType.unsignedIntegerValue) {
            case AVAudioSessionInterruptionTypeBegan: {
                /* the system has interrupted your audio session */
                /* Pause, Save State, Update UI */
                break;
            }
            case AVAudioSessionInterruptionTypeEnded: {
                if (interruptionOption && interruptionOption.unsignedIntegerValue == AVAudioSessionInterruptionOptionShouldResume) {
                    /* the interruption has ended */
                    /* Resume, Update State, Update UI */
                }
                break;
            }
        }
    }
    		

    The posted NSNotification instance contains a userInfo dictionary providing the details of the interruption. You can determine the type of interruption by retrieving the AVAudioSessionInterruptionType value from the userInfo dictionary. The interruption type indicates whether the interruption has begun or has ended. If the interruption type is AVAudioSessionInterruptionTypeEnded, the userInfo dictionary might contain an AVAudioSessionInterruptionOptions value. An options value of AVAudioSessionInterruptionOptionShouldResume is a hint that indicates whether your app should automatically resume playback if it had been playing when it was interrupted. Media playback apps should always look for this flag before beginning playback after an interruption. If it’s not present, playback should not begin again until initiated by the user. Apps that don’t present a playback interface, such as a game, can ignore this flag and reactivate and resume playback when the interruption ends.

Note: Please note that there is no guarantee that a begin interruption will have a corresponding end interruption. Your app needs to be aware of a switch to a foreground running state or the user pressing a Play button. In either case, determine whether your app should reactivate its audio session.

For more details, please refer to the following:

  1. https://developer.apple.com/documentation/avfoundation/avaudiosession/1616596-interruptionnotification
  2. https://developer.apple.com/library/archive/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/HandlingAudioInterruptions/HandlingAudioInterruptions.html

Version History

SDK 9.0

  • 9.0.1: 10/25/2019

    - Added support for IAB GDPR consent string

    - Updated OMSDK to v1.2.19

    - Seperated Moat SDK from InMobi SDK and added it as an optional dependency

    - Removed UIWebView from the SDK

    - Bug Fixes

  • 9.0.0: 9/20/19

    - Changes to support iOS 13

    - New and improved Modularised SDK design

    - Add InMobiMediationSDK.framework to your project for AerServ Mediation.

    - Addressing issue with layering of FAN banners upon refresh

    - SKStoreProductViewController crash fix.

    - Removed Support for iOS 8.

    - Removed Support for AerServ Native ad format.

    - Removed UIWebView from InMobi SDK. Viewability Partners might be using it.

    - Size reduction for both Framework and ipa inflation.

    - Various Bug Fixes and performance improvements

    - Adapter updates for the following mediation partners:

    • MoPub - v5.9.0
    • Google Mobile Ads - v7.50.0
  • 8.2.0: 8/5/19
    • Chrome Custom tabs support
    • Thread Optimizations
    • Bug Fixes for SDK and AudienceBidder Plugin
  • 8.1.2: 7/18/19
    • Size reduction
    • Support for Audience Bidding for DFP
    • New api to set slot size for Banner in Audience Bidding
  • 8.1.1: 6/19/19
    • Updated AdColony SDK support to 3.3.10
    • Updated Audience Network (Facebook) support to 5.3.1
  • 8.1.0: 5/14/19
    • DFP Plugin Support
    • Mopub Audience Bidding Plugin Keyword Handling
    • Bug fixes
  • 8.0.8: 4/17/19
    • Bug Fixes
  • 8.0.7: 4/05/19
    • Additional support for higher granularity keywords
  • 8.0.5: 3/11/19
    • Audience Bidder for the Mopub Plugin
    • Telaria Adapter Deprecation
    • Flurry Banner Adapter Deprecation
    • Applovin 3rd Party API Reporting updates
    • Chartboost 3rd Party API Reporting updates
    • Mediated SDK updates
    • Bug Fixes
  • 8.0.2: 12/13/18
    • Mediation bug Fixes
  • 8.0.1: 11/28/18
    • Unified InMobi + AerServ SDK