S2S Bidding
Server-to-server (S2S) bidding lets your app server run the auction with BidMachine instead of running it on the client. The client SDK provides a bid token, your server uses it to request bids, and the winning bid payload is passed back to the client to load the ad.
Flow
- Get a bid token — the client SDK generates an opaque token that encodes device/session signals.
- Run a server-side auction — your app server sends the token to the BidMachine auction endpoint and receives a bid response payload.
- Load the ad — the client passes the bid payload to
load(bidPayload:)instead of callingload().
Step 1 — Get a Bid Token
A public bid-token generator is in development and will be added in a future release. In the meantime, obtain the bid token out-of-band (e.g. through your server-side BidMachine integration) and use the load(bidPayload:) half below, which is available today.
Step 2 — Server-Side Auction
Your app server sends the bid token to the BidMachine S2S auction endpoint. The response contains a bid payload string that you pass back to the client. See the BidMachine S2S API documentation for endpoint details.
Step 3 — Load with Bid Payload
Pass the bid payload to load(bidPayload:) on any ad unit (Obj-C selector loadWithBidPayload:). It uses the same delegate callbacks as a regular load() call. This half is public and works today.
The only change from a normal load is the load call — delegate wiring is identical to Ad Integration.
- Swift
- Objective-C
// Banner
let banner = BannerAd(sdk, placementId: "YOUR_PLACEMENT_ID", size: .banner)
banner.delegate = self
banner.load(bidPayload: bidPayload)
// Interstitial
let interstitial = InterstitialAd(sdk, placementId: "YOUR_PLACEMENT_ID")
interstitial.delegate = self
interstitial.load(bidPayload: bidPayload)
// Rewarded
let rewarded = RewardedAd(sdk, placementId: "YOUR_PLACEMENT_ID")
rewarded.delegate = self
rewarded.load(bidPayload: bidPayload)
// Banner
BMBannerAd *banner = [[BMBannerAd alloc] init:sdk placementId:@"YOUR_PLACEMENT_ID" size:BMBannerAdSize.banner];
banner.delegate = self;
[banner loadWithBidPayload:bidPayload];
// Interstitial
BMInterstitialAd *interstitial = [[BMInterstitialAd alloc] init:sdk placementId:@"YOUR_PLACEMENT_ID"];
interstitial.delegate = self;
[interstitial loadWithBidPayload:bidPayload];
// Rewarded
BMRewardedAd *rewarded = [[BMRewardedAd alloc] init:sdk placementId:@"YOUR_PLACEMENT_ID"];
rewarded.delegate = self;
[rewarded loadWithBidPayload:bidPayload];