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:@[]];
}];
Parameter | Type | Description |
---|---|---|
id | String | |
name | String | |
domain | String | |
categories | Array 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"];
}];
Parameter | Type | Description |
---|---|---|
userId | String | Vendor-specific ID for the user. |
userGender | BidMachineUserGender | Gender, one of following: Female, Male, Unknown. |
userYOB | UInt32 | Year of birth as a 4-digit integer (e.g. 1990). |
userLocation | CLLocation | Location of the user's home base (i.e., not necessarily their current location). |
country | String | Country of the user's home base (i.e., not necessarily their current location). |
city | String | City of the user's home base (i.e., not necessarily their current location). |
zip | String | Zip of the user's home base (i.e., not necessarily their current location). |
keywords | String | List of keywords, interests, or intents. |
blockedApps | Array of String | Block 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). |
blockedCategories | Array of String | Block list of content categories using IDs. |
blockedAdvertisers | Array of String | Block list of advertisers by their domains (e.g. example.com ). |
storeURL | String | App store URL for the installed app; for IQG 2.1 compliance. |
storeId | String | Application identifier in AppStore ( numeric string e.q. "1111") |
storeCategory | String | |
storeSubCategories | Array of String | |
paid | BOOL | Determines, if it is a free or paid version of the app. |
frameworkName | BidMachineFrameworkName |
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:@"" :@[]];
}];
Parameter | Type | Description |
---|---|---|
coppa | BOOL | |
gdprZone | BOOL | |
gdprConsent | BOOL | |
gdprConsentString | String | |
usPrivacyString | String | |
GPP | String, 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];
Updated 7 months ago