In-House Mediation
Integration
Requirements
Requirements:
iOS 13.0+ ( start for 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
Xcode: 15.2, BidMachine SDK version >= 3.0.0
Xcode: 15.3, BidMachine SDK version >= 3.1.0
Network security configuration
Add this code to the info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
iOS 14+ & SKAdNetwork Support
Add SKAdNetworkIds
Ad networks used in BidMachine support conversion tracking using Apple's SKAdNetwork, which means ad networks are able to attribute an app install even when IDFA is unavailable. To enable this functionality, you will need to update the SKAdNetworkItems key with an additional dictionary in your Info.plist.
- Select Info.plist in the Project navigator in Xcode
- Right-click on Info.plist file → Open as → Source Code
- Copy the SKAdNetworkItems from below and paste it into your Info.plist file
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>wg4vff78zm.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>737z793b9f.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>ydx93a7ass.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>prcb7njmu6.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>mls7yz5dvl.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>7ug5zh24hu.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>44jx6755aq.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>2u9pt9hc89.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>w9q455wk68.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>yclnxrl5pm.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>p78axxw29g.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>4fzdc2evr5.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>4pfyvq9l8r.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>v72qych5uu.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>6xzpu9s2p8.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>mlmmfzh3r3.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>c6k4g5qg8m.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>g28c52eehv.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>523jb4fst2.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>ggvn48r87g.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>3sh42y64q3.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>f38h382jlk.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>24t9a8vw3c.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>hs6bdukanm.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>9nlqeag3gk.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>cj5566h2ga.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>ejvt5qm6ak.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>cstr6suwn9.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>wzmmz9fp6w.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>4468km3ulz.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>5lm9lj6jb7.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>zmvfpc5aq8.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>9rd848q2bz.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>7rz58n8ntl.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>feyaarzu9v.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>9t245vhmpl.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>n9x2a789qt.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>tl55sbb4fm.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>5a6flpkh64.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>8s468mfl3y.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>glqzh8vgby.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>424m5254lk.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>5l3tpt7t6e.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>uw77j35x4d.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>gta9lk7p23.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>av6w8kgt66.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>t38b2kh725.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>s39g8k73mm.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>m8dbw4sv7c.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>lr83yxwka7.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>kbd757ywx3.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>cg4yq2srnc.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>ludvb6z3bs.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>22mmun2rn5.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>su67r6k2v3.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>4w7y6s5ca2.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>klf5c3l5u5.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>dzg6xy7pwj.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>y45688jllp.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>hdw39hrw9y.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>ppxm28t8ap.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>4dzt52r2t5.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>mtkv5xtk9e.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>5tjdwbrq8w.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>3rd42ekr43.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>32z4fx6l9h.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>xy9t38ct57.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>54nzkqm89y.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>9b89h5y424.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>pwa73g5rt2.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>79pbpufp6p.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>294l99pt4k.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>s69wq72ugq.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>k674qkevps.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>578prtvx9j.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>2fnua5tdw4.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>f73kdq92p3.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>e5fvkxwrpn.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>n6fk4nfna4.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>x44k69ngh6.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>mp6xlyr22a.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>rx5hdcabgc.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>6g9af3uyq4.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>u679fj5vs4.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>qqp299437r.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>275upjj5gd.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>3qcr597p9d.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>97r2b46745.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>g2y4y55b64.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>44n7hlldy6.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>6p4ks3rnbw.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>rvh3l7un93.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>kbmxgpxpgc.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>74b6s63p6l.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>a7xqa6mtl2.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>zq492l623r.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>r45fhb6rf7.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>84993kbrcf.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>pwdxu55a5a.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>6964rsfnh4.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>24zw6aqk47.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>cs644xg564.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>9vvzujtq5s.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>c3frkrj4fj.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>8r8llnkz5a.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>WZMMZ9FP6W.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>vhf287vqwu.skadnetwork</string>
</dict>
</array>
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', '~> 3.1.0'
# Additionally, you can specify the type of library to use:
# pod 'BidMachine/Static', '~> 3.1.0'
# pod 'BidMachine/Dynamic', '~> 3.1.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"];
Custom init server configuration parameters
You can get the configuration from the BM server using a pre-agreed key
_ = BidMachineSdk.shared.extrasValue(by: "CUSTOM_MEDIATION_KEY")
id value = [BidMachineSdk.shared extrasValueBy:@"CUSTOM_MEDIATION_KEY"];
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 about 1 month ago