Create an iOS In-app Bidding Adapter

This article relates the technical implementation of an iOS custom bidding adapter. If you want to know more about in-app bidding or the reasons why should you create a custom bidding adapter and how it should work, please go to inapp-bidding overview or custom adapter page.

  1. SASBidderAdapterProtocol
    1. Competition type
    2. Rendering type
    3. Win notification callback
    4. Rendering methods
  2. SASBidderAdapter

SASBidderAdapterProtocol

To create your custom bidder adapter, you must create a class that conforms to SASBidderAdapterProtocol.

Most of the properties should be set upon initialization of your adapter even if they will only be "consumed" server-side when the adapter informations are forwarded to Smart through the ad call.

Please refer to the API documentation for complete list of the properties and methods to be implemented.

Competition type

When initializing your adapter, make sure to set the proper competitionType:

  • SASBidderAdapterCompetitionTypePrice means that Smart Display SDK will pass the price and the currency as parameters of the ad call, unobfuscated. With this competition type, you must implement the properties price and currency of the adapter.
  • SASBidderAdapterCompetitionTypeKeyword means that Smart Display SDK will pass a representation of the price, as a keyword, in the ad call. This keyword must match with the keyword targeting of a programmed insertion that has also an eCPM priority and CPM filled in the ad server. With this competition type, you must implement the property keyword of the adapter.

Rendering type

When initializing your adapter, make sure to set the proper creativeRenderingType:

  • SASBidderAdapterCreativeRenderingTypePrimarySDK means that Smart Display SDK will be responsible for rendering the winning creative whether it comes from the ad server or the in-app bidding competition. Therefore your adapter must provide the HTML Ad Markup to be displayed if in-app bidding wins.
  • SASBidderAdapterCreativeRenderingType3rdParty means that your partner's SDK will ultimately be responsible for rendering the winning creative and that a third party (such as your application) will trigger it. This situation occurs if Smart's ad-server loses the bidding competition. If the winning creative comes from Smart, the display will be done by Smart Display SDK as usual.
    Note : this is the only available rendering type for a native ad integration, as the application is always in charge of rendering the native ads.
  • SASBidderAdapterCreativeRenderingTypeMediation means that your partner's SDK will ultimately be responsible for rendering the winning creative but that the Smart Display SDK will mediate this rendering through the adapter and forward all necessary callbacks to the delegate of the instanciated Smart Display SDK ad view. This situation occurs if Smart's ad-server loses the bidding competition. If the winning creative comes from Smart, the display will be done by Smart Display SDK as usual.

Win notification callback

When the ad-server loses the server-side competition, meaning that it was not able to return an ad with a higher CPM than the third party bidder, Smart Display SDK will trigger the method:

When this method is called, you should perform all actions you think relevant to log the competition result.

Rendering methods

Several methods can be called for the rendering to occur, depending on the rendering type of the adapter.

 

Smart Display SDK Creative Rendering

This corresponds to the SASBidderAdapterCreativeRenderingTypePrimarySDK rendering type. For rendering of the creative to occur properly, your adapter must implement these methods:

 

Third party Creative Rendering

This corresponds to the SASBidderAdapterCreativeRenderingType3rdParty rendering type. For rendering of the creative to occur properly, your adapter must implement this method:

Note that with this mode, your adapter will have to trigger the display of the creative by the in-app bidding partner's SDK when the method is called. This means that your adapter should also keep a reference to the ad loader of the in-app bidding partner's SDK and will be responsible to forward ad events to the application.

 

Mediation Creative Rendering - Banner

This corresponds to the SASBidderAdapterCreativeRenderingTypeMediation rendering type for banner ads. For rendering of the creative to occur properly, your adapter must implement this method:

When this method is called, it is the right time to trigger the rendering of the banner for the bidder's SDK.

Note that with this mode, your adapter should forward the Bidder's SDK events to the SASBannerBidderAdapterDelegate provided, so that they are also forwarded to the delegate's of the Smart Display SDK ad view.

 

Mediation Creative Rendering - Interstitial

This corresponds to the SASBidderAdapterCreativeRenderingTypeMediation rendering type for interstitial ads. For rendering of the creative to occur properly, your adapter must implement these methods:

Note that with this mode, your adapter should forward the Bidder's SDK events to the SASInterstitialBidderAdapterDelegate provided, so that they are also forwarded to the delegate's of the Smart Display SDK ad view.

SASBidderAdapter

Another convenient way to create your custom adapter is by subclassing SASBidderAdapter.

You will need to override all the methods of SASBidderAdapterProtocol.

Make sure to select the proper competition type and creative rendering type depending on whether or not your third party in-app bidding SDK is able to display its creative by itself or not and if you prefer to have it mediated by Smart Display SDK.