Integration of Banner Ads

Document created by pubmatic-archivist on Mar 27, 2017
Version 1Show Document
  • View in full screen mode

Integrating Banner Ads


Creating Banner Ad View

In the ObjectiveC for Viewcontroller:

  1. Import PubMatic respective header files.
  2. Setup a PMBannerAdView

Example: PMBannerAdView Setup


PMBannerAdView * adView = [[PMBannerAdView alloc] initWithFrame:CGRectMake(<X>, <Y>, <WIDTH>,<HEIGHT>)] ;

autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;

adView.logLevel = PMAdViewLogEventTypeDebug;

[adView setLocationDetectionEnabled:YES];

[self.view addSubview:adView];

Example: Mocean AdRequest


MoceanBannerAdRequest *adRequest = [MoceanBannerAdRequest new];

adRequest.zoneId = <ZONE_ID>;

//Make the ad request to Server


Example: PubMatic AdRequest


PubMaticBannerAdRequest * adRequest = [[PubMaticBannerAdRequest alloc] initWithPublisherId:@"<PUB_ID>" WithSiteId:@"<SIDE_ID>" WithAdTagId:@"<AD_TAG_ID>"];

//Make the ad request to Server


Example: Phoenix AdRequest


PhoenixBannerAdRequest * adRequest =[PhoenixBannerAdRequest new];

adRequest.adunitId = @"<AD_UNIT_ID>";

adRequest.impressionId = @"ID1";

//Make the ad request to Server


Note: call [banner reset], method in dealloc method of it's controller class. Please refer sample application for same.