Amazon Publisher Services

This article is for publishers who want to use the DT FairBid SDK to load and display ads from Amazon Publisher Services (APS).

APS currently supports the following ad types:

  • Banner
  • Interstitial
  • Rewarded

For more information about the varioius types of ads and their specifications, see Ad Types and Specifications.

To integrate APS as an mediated ad network with DT:

Step 1: Retrieve APS Information

Before retrieving your APS information, complete the following tasks to create APS ad unit inventory to mediate with DT. For more information about how to create APS inventory, see the APS Portal documentation.

  • Create an APS account.

Note

Amazon Publisher Services (APS) is an invitation-only program. To create an APS account, request an invitation from APS. Once approved, APS sends an invitation with instructions on creating an your APS account.

  • Add your app to the APS Portal.
  • Add Slots for your app.
  • Update your App-ads.txt file to include the APS Portal.

Once you have created APS inventory, locate the following information in the APS Portal. This information is required later in Step 2 to set up APS as a DT mediated network.

APS INFO DESCRIPTION RETRIEVAL INSTRUCTIONS
Price Point Mapping CSV file containing ad unit pricing. Download CSV file. For more information about where to find the file, see the APS Portal documentation.
UUID Unique ID assigned to your APS ad slot. For more information about how to locate UUIDs, see the APS Portal documentation on UUIDs.

Step 2: Add APS as a Mediated Network

Before you add APS as a DT mediated network:

  • Ensure that you have access to the APS Portal information you retrieved in Step 1.
  • Add your App to the DT Console. For more information about how to add an app in the DT Console, see Adding Your App.
  • Ensure that you have a DT Placement for each APS ad type you want to mediate with DT. For more information about adding placements in the DT Console, see Creating Placements.

To add APS as a DT mediated network:

  1. Log in to the DT Console, and click App Management.
  1. Using the APS Price Point CSV file you downloaded in Step 1, add APS as a mediated network for your app. For more information about how to add a mediated network, see Adding Mediated Networks.

APS network parameters for DT

Note

DT uses the price point mapping across your entire account. If you update your price points in APS, ensure that you upload an updated CSV file in the DT Console.

  1. For each Placement that you want to mediate with DT, create an ad network instance for APS with the following settings:
    • Use the APS UUID you retrieved in Step 1 as the Instance ID.
    • Turn off the Auto CPM function. For more information about how to turn off Auto CPM, see Auto CPM.

    For more information about how to add instances to a Placement, see Creating Instances.

Step 3: Initialize the APS SDK

Initialize the APS SDK within your app so that DT can mediate your APS inventory.

iOS Android Unity

Initializing the APS SDK on iOS

The following process is recommended for initializing the APS SDK in Objective–C implementations on the iOS platform.

  1. Start the FairBid SDK.
+ [FairBid startWithAppId:options:]
  1. Start the APS SDK with the APP_KEY from the APS Portal.
- [DTBAds setAppKey:<<APP_KEY>>];
  1. Create an object that conforms to the id <FYBAPSSlotLoader> protocol, and assign it to the [FairBid apsAdapter].slotLoader property.
  1. Implement a Banner ad callback to trigger whenever you call + [FYBBanner showBannerInView:position:options:] for a placement with an APS instance in the waterfall.
-loadAPSBannerSlot:width:height:
  1. Implement a Rewarded ad callback to trigger whenever you call + [FYBRewarded request:placementId] for a placement with an APS instance in the waterfall.
-loadAPSRewardedSlot:(NSString *)slotUUID
  1. Implement a Interstitial ad callback to trigger whenever you call + [FYBInterstitial request:placementId] for a placement with an APS instance in the waterfall.
-loadAPSInterstitialSlot:(NSString *)slotUUID

Example: iOS Ad Slot Loader

#import <FairBidSDK/FairBidSDK.h>
#import <DTBiOSSDK/DTBiOSSDK.h>

@interface APSSlotLoader : NSObject <FYBAPSSlotLoader, DTBAdCallback>
@end

@implementation APSSlotLoader
// 4. Load Banner ad type callback
- (void)loadAPSBannerSlot:(nonnull NSString *)slotUUID width:(NSInteger)width height:(NSInteger)height {
    NSLog(@"[APS] loadAPSBannerSlot: %@, width: %li, height: %li", slotUUID, (long)width, (long)height);
    DTBAdLoader *loader = [DTBAdLoader new];
    DTBAdSize *size = [[DTBAdSize alloc] initBannerAdSizeWithWidth:width height:height andSlotUUID:slotUUID];if (!size) {
        NSLog(@"[APS] Failed to create DTBAdSize object: (width: %li, height: %li, andSlotUUID: %@)", (long)width, (long)height, slotUUID);
        return;
    }
    [loader setAdSizes:@[size]];
    [loader loadAd:self];
}

// 5. Load Rewarded ad type callback
- (void)loadAPSRewardedSlot:(NSString *)slotUUID  {
    NSLog(@"[APS] loadAPSRewardedSlot: %@", slotUUID;

    DTBAdLoader *loader = [DTBAdLoader new];
    DTBAdSize *size = [[DTBAdSize alloc] initVideoAdSizeWithPlayerWidth:320 height:480 andSlotUUID:slotUUID];;
    [loader setAdSizes:@[size]];
    [loader loadAd:self];
}

// 6. Load Interstitials ad type callback
- (void)loadAPSInterstitialSlot:(NSString *)slotUUID  {
    NSLog(@"[APS] loadAPSInterstitialSlot: %@", slotUUID;

    DTBAdLoader *loader = [DTBAdLoader new];
    DTBAdSize *size = [[DTBAdSize alloc] interstitialAdSizeWithSlotUUID:slotUUID];
    [loader setAdSizes:@[size]];
    [loader loadAd:self];
}

@end
  1. Create object that conforms to id <DTBAdCallback> protocol.
  1. Implement the -onSuccess: callback, and pass the following parameters back to FairBidSDK by calling -[[FairBid apsAdapter] setBidInfo:encodedPricePoint:slotUUID:].
    • adResponse.bidInfo
    • adResponse.amznSlots
    • adResponse.adSize.slotUUID
  1. (Optional) Implement the -onFailure: callback to receive error messages when APS cannot fill a slot.

Example: iOS Ad Callbacks

// 7. DTBAdCallback
// 8. onSuccess callback
- (void)onSuccess:(DTBAdResponse *)adResponse {
    NSLog(@"[APS] onSuccess: %@", adResponse);
    [[FairBid apsAdapter] setBidInfo:adResponse.bidInfo
                   encodedPricePoint:adResponse.amznSlots
                            slotUUID:adResponse.adSize.slotUUID];
}

// 9. onFailure callback
- (void)onFailure:(DTBAdError *)error {
    NSLog(@"[APS] onFailure: %@", error);
}

 

Step 4: Add the APS SDK to your Integration

To integrate the APS SDK, follow the instructions on the Supported Networks page.

Step 5: Test Your Integration

Use the DT Test Suite to verify that you have set up your app properly for FairBid mediation. The DT Test Suite is available for Android, iOS, and  Unity apps. For more information about using the DT Test Suite, see Test Suite.

DT Test Suite screen showing app is ready for mediation

Back to Top ⇧