Simple infeed advertising

In order to display advertisements, you need to enable SDK first. For details, please refer to Installing Guide and Initializing the SDK

A precondition for simple In-Feed advertisements is use of UITableView.

For other uses, use Customized In-Feed advertisements.

Displaying simple In-Feed advertisements

Here is an implementation example of simple In-Feed advertisement.

class YourViewController: UITableViewController, RFPInstreamAdLoaderDelegate {

    let adSpotId = "your_adspot_id"
    let adPositions = [3, 5]
    let instreamAdLoader = RFPInstreamAdLoader.init()

    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.delegate = self
        tableView.dataSource = self

        // Set the tableView and adspot ID for which you wish to insert the In-Feed advertisements
        instreamAdLoader.delegate = self
        instreamAdLoader.rfpBind(to: tableView, adSpotId: adSpotId)

        // Loading In-Feed advertisements
        instreamAdLoader.rfpLoadAd()

        // Case specifying the positions
        instreamAdLoader.rfpLoadAd(UInt(adPositions.count), positions: adPositions)
    }

    //....

}

There is no need to call tableView.reloadData(). If it is necessary to call tableView.reloadData(), call instreamAdLoader.rfpReloadData().

The number of advertisement cases and the advertisement position array per request can be controlled using APIs, such as instreamAdLoader.rfpLoadAd(_:positions:).

Acquisition of events when displaying simple In-Feed advertisements

When displaying In-Feed advertisements, you may choose to receive these events.

In this case, since the RFPInstreamAdLoader property delegate conforms to RFPInstreamAdLoaderDelegate, it may be received via RFPInstreamAdLoaderDelegate

override func viewDidLoad() {
    super.viewDidLoad()
    // (1) Set delegate
    instreamAdLoader.delegate = self
}

//(2) When starting advertisement loading
func rfpInstreamAdLoaderDidStartLoadingAd(_ instreamAdLoader: RFPInstreamAdLoader!) {
}

//(3) When completing advertisement loading
func rfpInstreamAdLoaderDidFinishLoadingAd(_ instreamAdLoader: RFPInstreamAdLoader!) {
}

//(4) When completing advertisement View loading
func rfpInstreamAdLoaderDidFinishLoadingAdImage(_ adIndexPath: IndexPath!) {
}

//(5) When completing advertisement click processing
func rfpInstreamAdLoaderDidFinishSendingAdClick() {
}

//(6) When advertisement loading fails
func rfpInstreamAdLoader(_ instreamAdLoader: RFPInstreamAdLoader!, didFailToLoadAdWithError error: Error!) {
}

//(7) When advertisement View loading fails
func rfpInstreamAdLoader(_ adIndexPath: IndexPath!, didFailToLoadAdImageWithError error: Error!) {
}

Additional loading of simple In-Feed advertisements

In the case of a UI that loads additional feeds when the user arrives at the bottom of the site, it is possible to provide additional loading of advertisements.

func loadMore {
    // Load additional advertisements and insert them at appropriate positions in the table based on the advertisement position array.
    instreamAdLoader.rfpReloadData()
}

Simple In-Feed advertisement format

Currently, seven advertising formats may be used. Settings are here.

  • 1-1) ThumnailMiddle
    // The format looks like this
    //  -----------------------------------------------------
    // |             |  name                                 |
    // |   image     |  ad text                              |
    // |             |                                       |
    // |   90x90     |                                       |
    // |             |                                    PR |
    //  -----------------------------------------------------
  • 1-2) ThumnailSmall
    // The format looks like this
    //  -----------------------------------------------------
    // |  -------    name                                    |
    // | | image |   PR                                      |
    // | | 50x50 |   ad text                                 |
    // | |       |                                           |
    // |  -------                                            |
    //  -----------------------------------------------------
  • 1-3) LandscapePhoto
    // The format looks like this
    //  -----------------------------------------------------
    // |                                                     |
    // |                  ad image                           |
    // |                                                     |
    // | --------------------------------------------------- |
    // |  ad text                                            |
    // |                                                     |
    // |                                                     |
    // |                                                 PR  |
    // |  advertiser  name                                   |
    //  -----------------------------------------------------
  • 1-4) PhotoBottom
    // The format looks like this
    //  -----------------------------------------------------
    // |  advertiser name                                    |
    // |  PR                                                 |
    // |  ad text                                            |
    // | --------------------------------------------------- |
    // |                                                     |
    // |                                                     |
    // |                   image                             |
    // |                                                     |
    //  -----------------------------------------------------
  • 1-5) PhotoMiddle
    // The format looks like this
    //  -----------------------------------------------------
    // | name                                                |
    // |                                                  PR |
    // | --------------------------------------------------- |
    // |                                                     |
    // |                                                     |
    // |                      image                          |
    // |                                                     |
    // |                                                     |
    // |                                                     |
    // | --------------------------------------------------- |
    // |  text                                               |
    //  -----------------------------------------------------
  • 1-6) TextOnly
    // The format looks like this
    //  -----------------------------------------------------
    // |  name                                               |
    // |                                                  PR |
    // | --------------------------------------------------- |
    // |                                                     |
    // |             ad text                                 |
    // |                                                     |
    // |                                                     |
    //  -----------------------------------------------------
  • 1-7) WebView
    • By drafting HTML, it is possible to depict this in WebView within the app.

Points to note when using simple In-Feed advertisements

The operation of UITableView passed to instreamAdLoader.rfpBind(to:adSpotId:)is only guaranteed when the number of sections is 1.