Adex

This feature allows customer to add inside app different kinds of ads. At this moment we support banner and full screen ads. First we need to initialize adex feature (choose one).

To support beacons for iOS:

  • Add Ocamba Track Id to Info.plist:

Open Info.plist file and add new key of type String to it’s content:

<key>OcambaHooodTrackID</key>
 <string>TRACK_ID</string>

Open AppDelegate class and add adex() to builder :

OcambaBuilder(apiKey: "ApiKey").adex().build()

NOTICE! replace TRACK_ID with yours track id.

Banner

  • Banner ads will be part of app’s layout, usually at the top or bottom of the screen. They will stay on the screen while user interacts with app. After each screen view banner will be refreshed (it show same ad again or different one).

  • Add View

Banner init has some required parameters:

BannerView(size: BannerSize, placementId: String, showCloseIcon: Bool)

size - is accepting an enum that has options : .small, .medium, .large, .adaptive

placementId - unique identifier for this ad.

showCloseIcon - with value Bool value that is defining if close button should be presented on the ad

  • How to load ad - this will show ad when it finish loading:
let banner = BannerView(size: .small, placementId: "PLACEMENT_ID", showCloseIcon:true)
banner.delegate = self
baner.loadAd()

NOTICE! Replace PLACEMENT_ID with yours placement id.

  • Listen for ad events:
/// Tells the delegate an ad request loaded an ad.
   func adBannerDidReceiveAd(_ bannerView:BannerView)
/// Tells the delegate an ad request failed.
   func adBanner(_ bannerView:BannerView, didFailToReceiveAdWithError error: Error)
/// Tells the delegate that a full-screen view will be presented in response to the user clicking on an ad.
   func adBannerWillPresentScreen(_ bannerView:BannerView)
/// Tells the delegate that the full-screen view has been dismissed.
   func adBannerWillDismissScreen(_ bannerView:BannerView)
/// Tells the delegate that a user click will open another app (such asthe App Store), backgrounding the current app.
   func adBannerWillLeaveApplication(_ bannerView: BannerView)
///Tells the delegate that user tapped on "Close" button
   func adBannerClosed(_ bannerView:BannerView)
  • Banner sizes:

    .small - 320x50

    .medium - 320x100

    .large - 300x250

    .adaptive - 320x32/50/90

Interstitial

  • Full screen ads (interstitial) are action based and displayed in full screen. They are typically displayed at natural transition points in app flow, between screens, clicks. When this ad is shown user has option to click on it or to close it and return to app.

  • Add view:

let interstitialAd = InterstitialAD(placementId:String)
interstitialAd.interstitialDelegate = self
  • Show ad:
interstitialAd.showAd()
  • Listen for ad events:
/// Tells the delegate an ad request loaded an ad.
   func interstitialDidReceiveAd(_ interstitialView:InterstitialAD)
/// Tells the delegate an ad request failed.
  func interstitialAd(_ interstitialView:InterstitialAD, didFailToReceiveAdWithError error: Error)
/// Tells the delegate that a full-screen view will be presented in response to the user clicking on an ad.
  func interstitialWillPresentScreen(_ interstitialView:InterstitialAD)
/// Tells the delegate that the full-screen view has been dismissed.
  func interstitialWillDismissScreen(_ interstitialView:InterstitialAD)
/// Tells the delegate that a user click will open another app (such as the App Store), backgrounding the current app.
  func interstitialWillLeaveApplication(_ interstitialView: InterstitialAD)
/// Tells the delegate that user tapped on "Close" button
  func interstitialClosed(_ interstitialView:InterstitialAD)