Request
Create request configuration
Request configuration is used to set bidding parameters
The request configuration is created with BidMachinePlacement which contains a special placement format. For example:
guard let placement = try? BidMachineSdk.shared.placement(from: .banner) else { return }
let request = BidMachineSdk.shared.auctionRequest(placement: placement)
NSError *error = nil;
BidMachinePlacement *placement = [[BidMachineSdk shared] placementFrom:PlacementFormatBanner
builder:nil
error:&error];
if (!placement) {
return;
}
BidMachineAuctionRequest *request = [[BidMachineSdk shared] auctionRequestWithPlacement:placement builder:nil];
Placement Format
Placement format is represented by enum: PlacementFormat and has the following values:
@objc(BidMachinePlacementFormat) public enum PlacementFormat : Int {
case unknown
case banner
case banner320x50
case banner728x90
case banner300x250
case interstitial
case interstitialVideo
case interstitialStatic
case rewarded
case rewardedVideo
case rewardedStatic
case media
case native
case nativeIcon
case nativeImage
case nativeVideo
case nativeIconAndVideo
case nativeIconAndImage
case nativeImageAndVideo
}
typedef SWIFT_ENUM_NAMED(NSInteger, BidMachinePlacementFormat, "PlacementFormat", open) {
BidMachinePlacementFormatUnknown = 0,
BidMachinePlacementFormatBanner = 1,
BidMachinePlacementFormatBanner320x50 = 2,
BidMachinePlacementFormatBanner728x90 = 3,
BidMachinePlacementFormatBanner300x250 = 4,
BidMachinePlacementFormatInterstitial = 5,
BidMachinePlacementFormatInterstitialVideo = 6,
BidMachinePlacementFormatInterstitialStatic = 7,
BidMachinePlacementFormatRewarded = 8,
BidMachinePlacementFormatRewardedVideo = 9,
BidMachinePlacementFormatRewardedStatic = 10,
BidMachinePlacementFormatMedia = 11,
BidMachinePlacementFormatNative = 12,
BidMachinePlacementFormatNativeIcon = 13,
BidMachinePlacementFormatNativeImage = 14,
BidMachinePlacementFormatNativeVideo = 15,
BidMachinePlacementFormatNativeIconAndVideo = 16,
BidMachinePlacementFormatNativeIconAndImage = 17,
BidMachinePlacementFormatNativeImageAndVideo = 18,
};
Placement format can be obtained from the string
_ = "PLACEMENT_FORMAT".bidmachine_placement_format
[@"PLACEMENT FORMAT" bidmachine_placement_format];
List of registered placement format names:
"banner"
"banner_320x50"
"banner_728x90"
"banner_300x250"
"interstitial_video"
"interstitial_static"
"interstitial"
"rewarded_video"
"rewarded_static"
"rewarded"
"media"
"native_icon"
"native_image"
"native_video"
"native_icon_video"
"native_icon_image"
"native_image_video"
"native"
Populate request configuration
Populate
let placement = try? BidMachineSdk.shared.placement(from: .banner) {
$0.withPlacementId("")
$0.withCustomParameters([String:Any]())
}
let request = BidMachineSdk.shared.auctionRequest(placement: placement) {
$0.withPayload("")
$0.withUnitConfigurations([BidMachineUnitConfiguration]())
$0.appendPriceFloor(Double(10), UUID().uuidString)
}
NSError *error = nil;
BidMachinePlacement *placement = [[BidMachineSdk shared] placementFrom:PlacementFormatBanner
builder:^(id<BidMachinePlacementBuilderProtocol> _Nonnull builder) {
[builder withPlacementId:@""];
[builder withCustomParameters:@{}];
} error:&error];
if (!placement) {
return;
}
BidMachineAuctionRequest *request = [[BidMachineSdk shared] auctionRequestWithPlacement:placement builder: ^(id<BidMachineAuctionRequestBuilderProtocol> _Nonnull builder) {
[builder withPayload:@""];
[builder withUnitConfigurations:@[]];
[builder appendPriceFloor:10.0 identifier:[[NSUUID UUID] UUIDString]];
}];
Parameters
BidMachinePlacement
Parameter | Type | Description |
---|---|---|
format | PlacementFormat | Placement format |
placementId | String | Placement id |
customParameters | Dictionary of String - Any | Custom parameters are passed directly to the server |
BidMachineAuctionRequest
Parameter | Type | Description |
---|---|---|
payload | String | Custom Bidmachine payload string |
unitConfigurations | Array of BidMachineUnitConfiguration | How to properly add Header Bidding AdUnits is described here |
priceFloor | First value - Double Second value - String | Custom price floor First value - price Second value - name |
Updated 5 days ago