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]())
.withContextualData(UInt64(1), TestContextualData())
.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 |
contextualData | First value - UInt64 Second value - BidMachineContextualDataProtocol | First value - Session duration Second value - Session data |
priceFloor | First value - Double Second value - String | Custom price floor First value - price Second value - name |
Contextual data
With the help of contextual data, publisher can transmit advertising analytics manually
Parameter | Type | Description |
---|---|---|
impressions | UInt32 | The count of impressions for a specific placement type in a given app session |
clickRate | Float | The percentage of clicks/impressions per user per placement type over a given number of impressions, where 5 represents a 5% CTR |
completionRate | Float | The percentage of successful completions/impressions for a user per placement type for a given number of impressions, where 70 represents a 70% completion rate. This only applies to Rewarded and Video placement types |
lastClickForImpression | Bool | An integer value indicating if the user clicked on the last impression in a given session per placement type, where "1" = user clicked, "0" = user didn't click |
lastBundle | String | The last app bundle the user saw on the previous impression in a given session per placement type |
lastAdomain | String | The last advertiser domain the user saw on the previous impression in a given session per placement type |
Updated about 1 year ago