Monetize

Last Updated on

July 15, 2022

iOS (banners)

⚠️ We do not serve banner ads to apps that are opted-out of behavioral targeting.

⚠️ You do not need to create a Banner Publishing Campaign on the Chartboost Dashboard. The banner ads are delivered through our Exchange. You only need to call on them via the SDK.

⚠️ Your Banner analytics are available in the App Analytics section of your Chartboost Dashboard.

⚠️ Multiple Banners can be displayed at once if desired.

Creating a banner

To create a banner you use the provided initializer initWithSize:location:delegate: providing a size, a Chartboost location, and an optional delegate.A banner ad has a CHBBannerSize which corresponds to the view's intrinsicContentSize. There are currently 3 banner sizes: CHBBannerSizeStandard, CHBBannerSizeMedium and CHBBannerSizeLeaderboard.If AutoLayout is being used you just give the banner an X and Y position constraint and it will be automatically sized. On the other hand, if you assign frames manually make sure to have the banner frames size equal to its CHBBannerSize property.

Example:

Showing banner ads

To make the banner show an ad first create and present it as seen before, and then call this method:

Banner ads sizes

  • 320 x 50
  • 300 x 250 (MREC)
  • 728 x 90

Banner delegates methods

Every banner has an optional delegate which can be provided when initialized or assigned afterwards.Implementing delegate methods is the way you can be notified and respond to events related to the banner life-cycle.These are all the delegate methods:

didCacheAd

Description: Called after a cache call, either if an ad has been loaded from the Chartboost servers and cached, or tried to but failed. Parameterevent: A cache event with info related to the cached ad. Parametererror: An error specifying the failure reason, or nil if the operation was successful. Discussion: Implement to be notified of when an ad is ready to be shown after the cache method has been called. Example:

willShowAd
  • Description: Called after a showFromViewController: call, right before an ad is presented.
  • Parameter event: A show event with info related to the ad to be shown.
  • Parameter error: An error specifying the failure reason, or nil if the operation was successful.
  • Discussion: Implement to be notified of when an ad is about to be presented.

Example:

didShowAd
  • Description: Called after a showFromViewController: call, either if the ad has been presented and an ad impression logged, or if the operation failed.
  • Parameter event: A show event with info related to the ad shown.
  • Parameter error: An error specifying the failure reason, or nil if the operation was successful.
  • Discussion: Implement to be notified of when the ad presentation process has finished.

Example:


shouldConfirmClick

Description: Called whenever the user clicks an ad to give a chance to the developer to present a confirmation gate before the click is handled. Parameterevent: A click event with info related to the ad clicked. ParameterconfirmationHandler: A block to be executed only if the return value is YES. It takes a BOOL parameter that indicates if the confirmation gate was passed or not. Returns: YES if the handling of the triggering click should be paused for confirmation, NO if the click should be handled without confirmation. Warning: If you return YES in your implementation make sure to execute the confirmationHandler at some point, since the ad flow will be paused until then. If you use the event’s view controller to present a confirmation view make sure it has been dismissed by the time you execute the confirmationHandler. Discussion: If you return YES it is your responsibility to implement some confirmation method that triggers the execution of the confirmationHandler. If this method is not implemented clicks will be handled without confirmation. Example:

didClickAd

Description: Called after an ad has been clicked. Parameterevent: A click event with info related to the ad clicked. Parametererror: An error specifying the failure reason, or nil if the operation was successful. Discussion: Implement to be notified when an ad has been clicked. If the click does not result into the opening of a link an error will be provided explaining why. Example:

didFinishHandlingClick

Description: Called when the link viewer presented as result of an ad click has been dismissed. Parameterevent: A click event with info related to the ad clicked. Parametererror: An error specifying the failure reason, or nil if the operation was successful. Discussion: Implement to be notified of when an ad click has been handled. This can mean an in-app web browser or App Store app sheet has been dismissed, or that the user came back to the app after the link was opened on an external application. Example: