Yieldprobe for iOS
The module Yieldprobe
provides an API to access the Yieldprobe Optimization Service.
Integration
- Select your Xcode project in the sidebar
- Select the project above the list of targets
- Select the tab “Swift Packages”
- Enter this value in the search bar
https://github.com/yieldlab/yieldprobe-sdk-ios.git
- Click “Next”
- Select “Branch” → “master”
- Click “Next”
- In the list “Choose package product and targets:” make sure you add “Yieldprobe, Library” to your app target.
- Import Yieldprobe into your code:
import Yieldprobe
- Start using the Yieldprobe API.
Yieldprobe works with full App Transport Security (ATS) enabled. However, it’s likely that other components require you to disable ATS. See the documentation of affected components for details.
Configuration
// Configure the SDK
var config = Yielprobe.Configuration()
config.appName = "My App"
config.bundleID = "com.example.my-app"
config.personalizeAds = true // see data privacy section for details
Yieldprobe.shared.configure(using: config)
Header Bidding
Yieldprobe.shared.probe(slot: <#adSlotID#>) { result in
do {
let bid = try result.get()
let dfp = DFPRequest()
dfp.customTargeting = try bid.customTargeting()
// TODO: Apply targeting to ad server request.
} catch {
// TODO: Handle errors like no bids, network failures, etc.
}
}
Data Privacy
In order to comply with data privacy regulations, Yieldprobe provides a way to configure its behavior in certain ways:
- Use
Configuration.personalizeAds
to specify whether (or not) to pass personal data to the server. - Use
Configuration.useGeolocation
to restrict access to geolocation data (will not be used ifpersonalizeAds
isfalse
). - An IAB Consent String will be read from
UserDefaults
and – if found – will be forwarded to the Yieldprobe servers. If you use an IAB compliant CMP, this will be picked up automatically.