Documentation

In-House Mediation

Integration

Requirements

🚧

Requirements:

iOS 12.0+ ( start for 2.3.0.0 )

Xcode: 14.2, BidMachine SDK version >= 2.4.0.0 <= 2.5.0

Xcode: 14.3.1, BidMachine SDK version >= 2.5.0

Network security configuration

Add this code to the info.plist file:

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
   <true/>
</dict>

Cocoa Pods

📘

Note

If you haven't used CocoaPods before, please read this guide first.

platform :ios, '12.0' 

source 'https://cdn.cocoapods.org/'

workspace 'App.xcworkspace'
use_frameworks!

target 'Target' do 
    pod 'BidMachine', '~> 2.7.0'
  
    # Additionally, you can specify the type of library to use:
    # pod 'BidMachine/Static', '~> 2.7.0'
    # pod 'BidMachine/Dynamic', '~> 2.7.0'
  
    project 'Project/Target.xcodeproj' 
end

Initialization

To initialize the SDK - you need to call the initialization method with your source id

BidMachineSdk.shared.initializeSdk("YOUR_SOURCE_ID")
[BidMachineSdk.shared initializeSdk:@"YOUR_SOURCE_ID"];

Status

Sdk status can be checked via method

_ = BidMachineSdk.shared.isInitialized
[BidMachineSdk.shared isInitialized];

Constants

_ = BidMachineSdk.sdkVersion
_ = BidMachineSdk.sdkName
_ = BidMachineSdk.partnerName
_ = BidMachineSdk.partnerVersion
NSString *version   = [BidMachineSdk sdkVersion];
NSString *name      = [BidMachineSdk sdkName];
NSString *partner   = [BidMachineSdk partnerName];
NSString *partnerV  = [BidMachineSdk partnerVersion];

Test mode + Logging mode

BidMachineSdk.shared.populate {
  $0.withTestMode(true)
      .withLoggingMode(true)
      .withBidLoggingMode(true)
      .withEventLoggingMode(true)
}
[BidMachineSdk.shared populate:^(id<BidMachineInfoBuilderProtocol> builder) {
  [builder withTestMode:YES];
  [builder withLoggingMode:YES];
  [builder withBidLoggingMode:YES];
  [builder withEventLoggingMode:YES];
}];

Targeting

The following section provides information about all parameters that can be passed to SDK.

Publisher info

BidMachineSdk.shared.publisherInfo.populate {
  $0.withId("")
    	.withName("")
    	.withDomain("")
    	.withCategories([String]())
}
[BidMachineSdk.shared.publisherInfo
    populate:^(id<BidMachinePublisherInfoBuilderProtocol> builder) {
      [builder withId:@""];
      [builder withName:@""];
      [builder withDomain:@""];
      [builder withCategories:@[]];
}];
ParameterTypeDescription
idString
nameString
domainString
categoriesArray of String

Targeting info

BidMachineSdk.shared.targetingInfo.populate {
  $0.withUserId("")
      .withUserGender(.male)
      .withUserYOB(UInt32(1))
      .withUserLocation(CLLocation(latitude : 1, longitude : 2))
      .withCountry("")
      .withCity("")
      .withZip("")
      .withKeywords("")
      .withBlockedApps([String]())
      .withBlockedCategories([String]())
      .withBlockedAdvertisers([String]())
      .withStoreURL("")
      .withStoreId("")
      .withStoreCategory("")
      .withStoreSubCategories([String]())
      .withPaid(true)
      .withFrameworkName(.native)
      .appendExternalId("key", "value")
}
[BidMachineSdk.shared.targetingInfo
    populate:^(id<BidMachineTargetingInfoBuilderProtocol> builder) {
      [builder withUserId:@""];
      [builder withUserGender:BidMachineUserGenderMale];
      [builder withUserYOB:(0)];
      [builder withUserLocation:[[CLLocation alloc] initWithLatitude:1 longitude:2]];
      [builder withCountry:@""];
      [builder withCity:@""];
      [builder withZip:@""];
      [builder withKeywords:@""];
      [builder withBlockedApps:@[]];
      [builder withBlockedCategories:@[]];
      [builder withBlockedAdvertisers:@[]];
      [builder withStoreURL:@""];
      [builder withStoreId:@""];
      [builder withStoreCategory:@""];
      [builder withStoreSubCategories:@[]];
      [builder withPaid:YES];
      [builder withFrameworkName:BidMachineFrameworkNameNative];
      [builder appendExternalId:@"key":@"value"];
}];
ParameterTypeDescription
userIdStringVendor-specific ID for the user.
userGenderBidMachineUserGenderGender, one of following: Female, Male, Unknown.
userYOBUInt32Year of birth as a 4-digit integer (e.g. 1990).
userLocationCLLocationLocation of the user's home base (i.e., not necessarily their current location).
countryStringCountry of the user's home base (i.e., not necessarily their current location).
cityStringCity of the user's home base (i.e., not necessarily their current location).
zipStringZip of the user's home base (i.e., not necessarily their current location).
keywordsStringList of keywords, interests, or intents.
blockedAppsArray of StringBlock list of apps where ads are disallowed. These should be bundle or package names (e.g. com.foo.mygame) and should NOT be app store IDs (e.g., not iTunes store IDs).
blockedCategoriesArray of StringBlock list of content categories using IDs.
blockedAdvertisersArray of StringBlock list of advertisers by their domains (e.g. example.com).
storeURLStringApp store URL for the installed app; for IQG 2.1 compliance.
storeIdStringApplication identifier in AppStore ( numeric string e.q. "1111")
storeCategoryString
storeSubCategoriesArray of String
paidBOOLDetermines, if it is a free or paid version of the app.
frameworkNameBidMachineFrameworkName

Regulation info

BidMachineSdk.shared.regulationInfo.populate {
  $0.withCOPPA(true)
      .withGDPRZone(true)
      .withGDPRConsent(true)
      .withGDPRConsentString("")
      .withUSPrivacyString("")
      .withGPP("", [])
}
[BidMachineSdk.shared.regulationInfo
    populate:^(id<BidMachineRegulationInfoBuilderProtocol> builder) {
      [builder withCOPPA:YES];
      [builder withGDPRZone:YES];
      [builder withGDPRConsent:YES];
      [builder withGDPRConsentString:@""];
      [builder withUSPrivacyString:@""];
      [builder withGPP:@"" :@[]];
}];
ParameterTypeDescription
coppaBOOL
gdprZoneBOOL
gdprConsentBOOL
gdprConsentStringString
usPrivacyStringString
GPPString, Array of UInt32

📘

CCPA String

SDK automatically retrieves CCPA string from UserDefaults. If you would like to pass CCPA string according to IAB standards, please add it in UserDefaults. More information here.

📘

GPP

SDK automatically retrieves GPP from UserDefaults. If you would like to pass GPP according to IAB standards, please add it in UserDefaults. More information here and here

Bid token

With S2S integration, you will need a token that you need to transfer in the request. To get a token, you can use method:

 BidMachineSdk.shared.token(with: .banner) { token in }
[BidMachineSdk.shared tokenWith:BidMachinePlacementFormatBanner completion:^(NSString *token) {
            
}];

The full set of types can be viewed here

Mediation

If the request is involved in third-party mediation, you can use such methods to notify the SDK about the win or loss events:

//Where ad - is loaded bidmachine ad
//Mediation WIN ( ad )
BidMachineSdk.shared.notifyMediationWin(ad)
//Mediation LOSS ( winner, price, ad )
BidMachineSdk.shared.notifyMediationLoss("WINNER_NETWORK", 1.0, ad)
//Where ad - is loaded bidmachine ad
//Mediation WIN ( ad )
[BidMachineSdk.shared notifyMediationWin:ad];
//Mediation LOSS ( winner, price, ad )
[BidMachineSdk.shared notifyMediationLoss:@"WINNER_NETWORK" ecpm:1.0 ad:ad];