Request
Create request configuration
Request configuration is used to set bidding parameters
The request configuration is created with a special placement format. For example:
let config = try? BidMachineSdk.shared.requestConfiguration(.banner)
NSError *error = nil;
id<BidMachineRequestConfigurationProtocol> config = [BidMachineSdk.shared requestConfiguration:BidMachinePlacementFormatBanner error:&error];
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 config = try? BidMachineSdk.shared.requestConfiguration(.banner)
guard let config = config else { return }
config.populate {
$0.withPlacementId("")
.withPayload("")
.withTimeout(Double(1))
.withCustomParameters([String:Any]())
.withUnitConfigurations([BidMachineUnitConfiguration]())
.appendPriceFloor(Double(10), UUID().uuidString)
}
NSError *error = nil;
id<BidMachineRequestConfigurationProtocol> config = [BidMachineSdk.shared requestConfiguration:BidMachinePlacementFormatBanner error:&error];
[config populate:^(id<BidMachineRequestBuilderProtocol> builder) {
[builder withPlacementId:@""];
[builder withPayload:@""];
[builder withTimeout:2];
[builder withCustomParameters:@{}];
[builder withUnitConfigurations:@[]];
[builder appendPriceFloor:1:@""];
}];
Parameters
Parameter | Type | Description |
---|---|---|
placementId | String | Placement id |
payload | String | Custom Bidmachine payload string |
timeout | Double | Ad loading timeout |
customParameters | Dictionary of String - Any | Custom parameters are passed directly to the server |
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 4 months ago