Custom AdNetwork iOS

From POKKT DOCUMENTATION
Jump to: navigation, search

Custom Ad Network

This guide is intended for publishers looking to add support for Video, banner and interstitial within Pokkt mediation with an Ad Network not listed or supported by POKKT. Supported Ad Networks are listed in publisher dashboard.

Define a Custom AdNetwork

Following are the requirement to enable custom ad network in our Pokkt Dashboard:

  1. Add option to add a custom ad network in AdNetwork, navigate to mediation tab and click on "New Network".
    bordered
  2. To add Custom ad network need to provide below details:
    bordered
    • Classname: Enter the fully qualified name of the class that implements the custom AdNetwork.
    • Extra Param: If you wish to pass an argument to your custom AdNetwork, enter the appropriate string.
    • AdFormat: Ad Format like Video , Interstitial and Banner.
    • ECPM: Put your expected value of ECPM which will in turn rank this network in comparison to other configured networks.

Video & Interstitial Custom AdNetwork

  1. Create a class in your application which will implement Pokkt AdNetwork.
  2. This newly created class will override following methods and implement code that request video and interstitial ads.
    • - (void) initNetworkWithNetworkModel: (PokktNetworkModel *)networkModel;
    • - (void) cacheAd: (PokktAdConfig *)adConfig;
    • - (void) showAd: (PokktAdConfig *)adConfig viewController:(UIViewController *)viewController;
    • - (void) setCacheTimedOut: (PokktAdConfig *)adConfig;
    • - (BOOL) checkAdFormatSupport:(PokktAdConfig *)adConfig;
    • - (PokktNetworkModel *)getNetworkModel;
    • - (void) notifyDataConsentChanged:(PokktConsentInfo *)consentInfo
  3. You must notify Pokkt of all of the following Video/Interstitial lifecycle events, by calling the below methods in your delegates methods:
    • + (void)didFinishedAdDownload: (PokktNetworkModel *)networkModel adConfig: (PokktAdConfig *)adConfig rewardValue: (float)reward downLoadTime: (NSString *)downloadTime;
    • + (void)didFailedAdDownload:(PokktNetworkModel *)networkModel adConfig: (PokktAdConfig*)adConfig errorMessage:(NSString *)errorMsg;
    • + (void)onAdCompleted: (PokktNetworkModel *)networkModel adConfig: (PokktAdConfig*)adConfig;
    • + (void)onAdDisplayed: (PokktNetworkModel *)networkModel adConfig: (PokktAdConfig *)adConfig;
    • + (void)onAdGratified: (PokktNetworkModel *)networkModel adConfig: (PokktAdConfig*)adConfig rewardPoint: (float)reward;
    • + (void)onAdSkipped: (PokktNetworkModel *)networkModel adConfig: (PokktAdConfig*)adConfig;
    • + (void)onAdClosed: (PokktNetworkModel *)networkModel adConfig: (PokktAdConfig*)adConfig;
    • + (void)didFailedToShowAd: (PokktNetworkModel *)networkModel adConfig: (PokktAdConfig*)adConfig;

Example: How to notify POKKT SDK from your delegates methods. See the below example:

+ (void)onAdLoaded: (SampleVideo *)videoAd /* This is Sample app delegate Method */
{
[PokktNetworkDelegate didFinishedAdDownload:self.networkModel adConfig:adConfig rewardValue:1
downLoadTime:@""]; /* This is Pokkt delegate Method You have to notify pokkt sdk once your ad loaded
successfully */
}

  1. Create a subclass of PokktBannerCustomEvent in your application.
  2. PokktBannerCustomEvent class implement the PokktAdNetwork protocols. And Override following methods and implement code that request banner ads.
    - (void) fetchAd:(PokktAdConfig *)adConfig
        withAdView:(UIView *)bannerView
        withRootViewController:(UIViewController *)rootViewController
        withDelegate:(id<PokktBannerDelegate>)bannerDelegate
        onSuccess:(void(^)(id))successCallback
        onFailure:(void(^)(id))failureHandler;
  3. You must notify Pokkt of all of the following Banner lifecycle events, by calling the below methods in your delegates methods:
    • - (void)bannerLoaded:(NSString *)screenName;
    • - (void)bannerLoadFailed:(NSString *)screenName errorMessage:(NSString *)errorMessage;

Example: How to notify POKKT SDK from your delegates methods. See the below example:

+ (void)onBannerAdLoaded: (SampleBannerAd *)bannerAd /* This is Sample app delegate Method */
{
[self.bannerDelegate bannerLoaded:<screenName>];
/* This is Pokkt delegate Method You have to notify pokkt sdk once your ad loaded successfully */
}