Documentation

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

ParameterTypeDescription
placementIdStringPlacement id
payloadStringCustom Bidmachine payload string
timeoutDoubleAd loading timeout
customParametersDictionary of String - AnyCustom parameters are passed directly to the server
unitConfigurationsArray of BidMachineUnitConfigurationHow to properly add Header Bidding AdUnits is described here
contextualDataFirst value - UInt64
Second value -
BidMachineContextualDataProtocol
First value - Session duration
Second value - Session data
priceFloorFirst 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

ParameterTypeDescription
impressionsUInt32The count of impressions for a specific placement type in a given app session
clickRateFloatThe percentage of clicks/impressions per user per placement type over a given number of impressions, where 5 represents a 5% CTR
completionRateFloatThe 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
lastClickForImpressionBoolAn 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
lastBundleStringThe last app bundle the user saw on the previous impression in a given session per placement type
lastAdomainStringThe last advertiser domain the user saw on the previous impression in a given session per placement type