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. It uses the same events as a regular Load() call — only the Load call changes.
Banner
var banner = new BannerAd(sdk, placementId: "YOUR_PLACEMENT_ID", size: BannerAdSize.Banner);
banner.Loaded += (s, e) => banner.Show(BannerPosition.HorizontalBottom);
banner.LoadFailed += (s, e) => Debug.LogError($"Banner load failed: {e.Error.Message}");
banner.Load(bidPayload);
Interstitial
var ad = new InterstitialAd(sdk, placementId: "YOUR_PLACEMENT_ID");
ad.Loaded += (s, e) => ad.Show();
ad.LoadFailed += (s, e) => Debug.LogError($"Interstitial load failed: {e.Error.Message}");
ad.Load(bidPayload);
Rewarded
var ad = new RewardedAd(sdk, placementId: "YOUR_PLACEMENT_ID");
ad.Loaded += (s, e) => ad.Show();
ad.UserQualifiedForReward += (s, e) => { /* grant reward to the user */ };
ad.LoadFailed += (s, e) => Debug.LogError($"Rewarded load failed: {e.Error.Message}");
ad.Load(bidPayload);