Integrate Smart Display SDK as a In-App Bidding partner

  1. Retrieving an In-App Bidding ad
    1. Implementing the SASBiddingManager class
    2. Loading a bidding ad
    3. Implementing the SASBiddingManagerDelegate protocol
    4. The SASBiddingAdResponse class
  2. Loading and displaying a bidding response
    1. Banner format
    2. Interstitial format
    3. Rewarded Video format

Retrieving an In-App Bidding ad

Implementing the SASBiddingManager class

The SASBiddingManager object is in charge of making the In-App Bidding calls to Smart servers and returning ads with their corresponding price.

The SASBiddingManager is initialized using the init(adPlacement:biddingAdFormatType:currency:delegate:) method. You will need to provide three parameters:

  • adPlacement: the ad placement on which the ad should be retrieved by the manager.
  • biddingAdFormatType: the ad format that should be retrieved by the manager.
  • delegate: a object implementing the SASBiddingManagerDelegate protocol.

The ad placement parameters is a SASBiddingAdFormatType enumeration and can take the following values:

  • banner
  • interstitial
  • rewarded video

Example of a SASBiddingManager instantiation:


// Creation of the SASAdPlacement.
let adPlacement = SASAdPlacement(siteId: 123, pageId: 456, formatId: 789) // replace site/page/format values with your own.

// Creation of the SASBiddingManager
let biddingManager = SASBiddingManager(adPlacement: adPlacement,
                                       biddingAdFormatType: .banner,
                                       currency: "USD",
                                       delegate: self)
      

// Creation of the SASAdPlacement.
SASAdPlacement *placement = [[SASAdPlacement alloc] initWithSiteId:123 pageId:456 formatId:789]; // replace site/page/format values with your own.

// Creating the bidding manager that will handle all bidding ad calls.
SASBiddingManager *biddingManager = [[SASBiddingManager alloc] initWithAdPlacement:placement
                                                               biddingAdFormatType:SASBiddingAdFormatTypeBanner
                                                                          currency:@"USD"
                                                                          delegate:self];
      

Loading a bidding ad

Once the SASBiddingManager instance is created, you can request an ad simply by calling the load() method:


biddingManager.load()
        

[biddingManager load];
        

The outcome of the bidding call will be handled by the SASBiddingManagerDelegate passed at the creation of the SASBiddingManager as described below.

Implementing the SASBiddingManagerDelegate protocol

The SASBiddingManagerDelegate is the protocol that must be implemented to handle the bidding call outcome:


func biddingManager(_ biddingManager: SASBiddingManager, didLoad biddingAdResponse: SASBiddingAdResponse) {
  // Method called when the bidding manager succeeded to load a bidding ad.
}

func biddingManager(_ biddingManager: SASBiddingManager, didFailToLoadWithError error: Error) {
  // Method called when the bidding manager failed to load a bidding ad.
}
      

- (void)biddingManager:(SASBiddingManager *)biddingManager didLoadAdResponse:(SASBiddingAdResponse *)biddingAdResponse {
  // Method called when the bidding manager succeeded to load a bidding ad.
}

- (void)biddingManager:(SASBiddingManager *)biddingManager didFailToLoadWithError:(NSError *)error {
  // Method called when the bidding manager failed to load a bidding ad.
}
      

If case of a failing bidding call, the SASBiddingManager instance will call the biddingManager(_:didFailToLoadWithError:) method passing the Error instance representing the reason of the failure.

In case of a successful bidding call, the SASBiddingManager instance will call the biddingManager(_:didLoad:) method passing the SASBiddingAdResponse object representing the ad that won the bid. You will find more information about it in the section below.

The SASBiddingAdResponse class

The SASBiddingAdResponse is the object containing the ad content to be displayed, along with its price, its format type and the placement it was delivered on.

To compare this ad response with other partner's responses you will check the biddingAdPrice property that returns a SASBiddingAdPrice object representing the CPM of the received ad.

The SASBiddingAdPrice instance contains two informations you can use to create a competion between Smart and third party SDKs:

  • the response CPM
  • the response currency (the currency is a 3 letters string, ISO 4217 compliant)

Should your competition select that SASBiddingAdResponse as the winning ad, you will pass this instance to a banner, an interstitial or a rewarded video to be actually displayed. For more information, please check the next section.

Loading and displaying a bidding response

When a valid SASBiddingAdResponse has won the competition according to your criterias, you need to load it and display it as a banner, an interstitial or a rewarded video. To load a SASBiddingAdResponse in a banner, you simply need to use the load(biddingAdResponse:) of the SASBannerView (instead of the load with placement method).

// Loading the winning bidding ad response in a banner
banner.load(biddingAdResponse)
      

// Loading the winning bidding ad response in a banner
[bannerView loadBiddingAdResponse:biddingAdResponse];
      

For more information on SASBannerView integration, check the banner integration guide.

Interstitial format

To load a SASBiddingAdResponse in a interstitial, you simply need to initialize your SASInterstitialManager using the init(biddingAdResponse:delegate:) method.

// Instantiate an interstitial manager using the winning bidding response
let interstitialManager = SASInterstitialManager(biddingAdResponse: biddingAdResponse, delegate: self)

// Load the ad (as it is done for a regular ad)
interstitialManager.load()
      

// Instantiate an interstitial manager using the winning bidding response
SASInterstitialManager *interstitialManager = [[SASInterstitialManager alloc] initWithBiddingAdResponse:biddingAdResponse delegate:self];

// Load the ad (as it is done for a regular ad)
[interstitialManager load];
      

You can then display the ad as usual using the show(from:) method.

For more information on SASInterstitialManager integration, check the interstitial integration guide.

Rewarded Video format

To load a SASBiddingAdResponse in a rewarded video, you simply need to initialize your SASRewardedVideoManager using the init(biddingAdResponse:delegate:) method.

// Instantiate a rewarded video manager using the winning bidding response
let rewardedVideoManager = SASRewardedVideoManager(biddingAdResponse: biddingAdResponse, delegate: self)

// Load the ad (as it is done for a regular ad)
rewardedVideoManager.load()
      

// Instantiate a rewarded video manager using the winning bidding response
SASRewardedVideoManager *rewardedVideoManager = [[SASRewardedVideoManager alloc] initWithBiddingAdResponse:biddingAdResponse delegate:self];

// Load the ad (as it is done for a regular ad)
[rewardedVideoManager load];
      

You can then display the ad as usual using the show(from:) method.

For more information on SASRewardedVideoManager integration, check the rewarded video integration guide.