Revenue Tracking
Every load and impression event delivers an AdInfo (BMAdInfo) object to delegate callbacks.
AdInfo Fields
| Field | Type | Description |
|---|---|---|
placementId | String | Placement ID from the BidMachine dashboard |
price | Double | eCPM ÷ 1000 (e.g. 0.005 = $5 CPM) |
precision | RevenuePrecision | Confidence level of the reported price |
info | [String: String] | Raw metadata; known keys: networkName, dsp, ecpm |
Revenue Precision
RevenuePrecision is an Int-backed enum with three cases (no string name is exposed — use .rawValue for an Int):
| Swift | Obj-C | Description |
|---|---|---|
.exact | RevenuePrecisionExact | Real-time auction price |
.estimated | RevenuePrecisionEstimated | Estimated based on historical data |
.unknown | RevenuePrecisionUnknown | Precision could not be determined |
Revenue Callback
The didPayRevenue callback is fired when a billable impression is recorded — use it to forward revenue data to your analytics platform.
- Swift
- Objective-C
func didPayRevenue(adInfo: AdInfo) {
analytics.trackRevenue(
adUnit: adInfo.placementId,
revenue: adInfo.price,
precision: adInfo.precision.rawValue,
network: adInfo.info["networkName"]
)
}
- (void)didPayRevenueWithAdInfo:(BMAdInfo *)adInfo {
[self.analytics trackRevenue:adInfo.placementId
revenue:adInfo.price
precision:(long)adInfo.precision
network:adInfo.info[@"networkName"]];
}