Audio Ads

Enhance your app's monetization potential with InMobi's cutting-edge Audio Ads feature. With InMobi's SDK support for Audio Ads, you can seamlessly integrate high-quality, targeted audio advertisements into your app's audio content. Engage your users with relevant and captivating audio messages that fit seamlessly within their experience.

Set up Audio Ad

  1. From the left navigation, select Inventory Inventory Settings.
  2. Search for the app or website you would like to create a placement for and click + Add a placement.
  3. Click Select Ad Unit and select Audio Icon.
  4. Click Add a placement to start setting up your Audio settings. After you create the audio placement, you can see the placement ID.

Add Audio Ad to Your App

Note

  • Ensure you have updated the InMobi iOS SDK to version 10.5.6 or above.
  • Creating an InMobiAudio object before SDK initialization throws an error.

Add An Audio Slot in Code

Import the headers and declare an Audio instance in your ViewController.h file or import the frameworks and declare an Audio instance in your ViewController.swift file. Your ViewController header file should look like:

import UIKit 
import InMobiSDK 
class ViewController: UIViewController, IMAudioDelegate { 
    var audioAd: IMAudio? 
}

Load Audio Ad

Instantiate the audio object. Your ViewController.m file should look like this:

override func viewDidLoad() { 
      super.viewDidLoad() 
         
      let audioAd = IMAudio(frame: CGRect(x: 0, y: 0, width: 70, height: 70), placementId: "<placementId>", delegate: self) 
      audioAd.load() 
      self.view.addSubview(audioAd) 
}

Show Audio Ad

To show an audio ad, call show() on the InMobiAudio instance, after SDK generates the audioAdDidFinishLoading event.

func audioAdDidFinishLoading(_ audioAd: IMAudio) { 
    audioAd.show() 
}

Optimization

Listen for Audio Ad Lifecycle Events

If you want to listen to key events in the audio ad lifecycle, you can implement the IMAudioDelegate method. A sample implementation is shown below.

func audioAdDidFinishLoading(_ audioAd: IMAudio) {} 
func audioAdDidBecomeVisible(_ audioAd: IMAudio) {} 
func audioAd(_ audioAd: IMAudio, didReceiveWithMetaInfo info: IMAdMetaInfo) {} 
func audioAd(_ audioAd: IMAudio, didFailToLoadWithError error: IMRequestStatus) {} 
func audioAd(_ audioAd: IMAudio, didFailToShowWithError error: IMRequestStatus) {} 
func audioAdImpressed(_ audioAd: IMAudio) {} 
func audioAd(_ audioAd: IMAudio, didInteractWithParams params: [String: Any]?) {} 
func audioAdWillPresentScreen(_ audioAd: IMAudio) {} 
func audioAdDidPresentScreen(_ audioAd: IMAudio) {} 
func audioAdWillDismissScreen(_ audioAd: IMAudio) {} 
func audioAdDidDismissScreen(_ audioAd: IMAudio) {} 
func userWillLeaveApplicationFromAudioAd(_ audioAd: IMAudio) {} 
func audioAd(_ audioAd: IMAudio, rewardActionCompletedWithRewards rewards: [String: Any]) {} 
func audioAd(_ audioAd: IMAudio, audioStatusChanged status: IMAudioStatus) { 
  switch status: 
   case .playing: break 
   case .paused: break 
   case .completed: break 
} 

Note

The bid value can be accessed from the IMAdMetaInfo object’s getBid function. You can find more information in the bidInfo property.

Destroy Audio Object

You can release the resources after showing an audio ad by calling cancel.

audioAd.cancel()

Integrate Rewarded Audio Icons

Set up Audio Ad

  1. From the left navigation select Inventory Inventory Settings.
  2. Search for the app or website you would like to create a placement for and click + Add a placement.
  3. Click Select Ad Unit and select Rewarded Audio.
  4. Click Add a placement to start setting up your rewarded video settings. After you create the rewarded video placement, you can see the placement ID.

Add Rewarded Audio Ad to Your App

The implementation for Rewarded Audio Icon ads closely resembles that of Audio Icons.

You are expected to present a prompt to users, seeking their opt-in prior to displaying the rewarded audio icon ad. The InMobi SDK also offers the rewardActionCompletedWithRewards event for Rewarded ads. However, you can retain the flexibility to determine the timing of user rewards using various event callbacks.

func audioAd(_ audioAd: IMAudio, rewardActionCompletedWithRewards rewards: [String: Any]) { 
    // Do reward operation 
}

Test Integration

Using sandbox ads, you can assess the placement and refine the user experience. This involves configuring the placement in Test Mode, setting it as 'Global' within the placement settings. It's important to ensure that you set the device volume to a sufficient level to ensure ad playback.

For those employing manual SDK integration, it's imperative to initialize the InMobi SDK within the mediation debugger to ensure seamless operation and accurate evaluation.

On This Page

Last Updated on: 22 Aug, 2023