Create an ad tag waterfall (iOS)

Increase revenue-generating opportunities in your iOS app with an array of ad tags.

Creating an ad tag waterfall helps you to maximize ad revenue by attempting to show a valid ad to your viewers during an ad break. When you create an ad tag waterfall, you assign an array of ad tags to a single ad break. The player displays the ad of the first tag that returns a valid response.

Use the following steps to create an ad tag waterfall:

  1. Define the ad break offset. In the following example, the ad break is a pre-roll ad break.
  2. Pass an array of ad tags to JWAdBreakBuilder(). If the ad tags are valid, JWAdBreakBuilder() builds a JWAdBreak object.
  3. Follow the remaining steps to set up an ad break with VAST or Google IMA ads.

let adBreak = try? JWAdBreakBuilder()
JWError *error;
JWAdBreakBuilder *builder = [[JWAdBreakBuilder alloc] init];
[builder tags: @[[NSURL URLWithString:@"ad-tag-url-1.xml"],
                 [NSURL URLWithString:@"ad-tag-url-2.xml"],
                 [NSURL URLWithString:@"ad-tag-url-3.xml"]]];
JWAdOffset *offset = [JWAdOffset preroll];
[builder offset: offset];
JWAdBreak *adBreak = [builder buildAndReturnError:&error];