Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture SeatNonBids for rejected bids due to floor enforcement #3625

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions exchange/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ func (e *exchange) HoldAuction(ctx context.Context, r *AuctionRequest, debugLog
errs = append(errs, &errortypes.Warning{
Message: fmt.Sprintf("%s bid id %s rejected - bid price %.4f %s is less than bid floor %.4f %s for imp %s", rejectedBid.Seat, rejectedBid.Bids[0].Bid.ID, rejectedBid.Bids[0].Bid.Price, rejectedBid.Currency, rejectedBid.Bids[0].BidFloors.FloorValue, rejectedBid.Bids[0].BidFloors.FloorCurrency, rejectedBid.Bids[0].Bid.ImpID),
WarningCode: errortypes.FloorBidRejectionWarningCode})
rejectionReason := ResponseRejectedBelowFloor
if rejectedBid.Bids[0].Bid.DealID != "" {
rejectionReason = ResponseRejectedBelowDealFloor
ashishshinde-pubm marked this conversation as resolved.
Show resolved Hide resolved
}
seatNonBids.addBid(rejectedBid.Bids[0], int(rejectionReason), rejectedBid.Seat)
}
}

Expand Down
3 changes: 2 additions & 1 deletion exchange/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@ func runSpec(t *testing.T, filename string, spec *exchangeSpec) {
Enabled: spec.EventsEnabled,
},
DebugAllow: true,
PriceFloors: config.AccountPriceFloors{Enabled: spec.AccountFloorsEnabled},
PriceFloors: config.AccountPriceFloors{Enabled: spec.AccountFloorsEnabled, EnforceDealFloors: spec.AccountEnforceDealFloors},
Privacy: spec.AccountPrivacy,
Validations: spec.AccountConfigBidValidation,
},
Expand Down Expand Up @@ -5493,6 +5493,7 @@ type exchangeSpec struct {
HostConfigBidValidation config.Validations `json:"host_bid_validations"`
AccountConfigBidValidation config.Validations `json:"account_bid_validations"`
AccountFloorsEnabled bool `json:"account_floors_enabled"`
AccountEnforceDealFloors bool `json:"account_enforce_deal_floors"`
FledgeEnabled bool `json:"fledge_enabled,omitempty"`
MultiBid *multiBidSpec `json:"multiBid,omitempty"`
Server exchangeServer `json:"server,omitempty"`
Expand Down
147 changes: 147 additions & 0 deletions exchange/exchangetest/floors_deal_enforcement.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"floors_enabled": true,
"account_floors_enabled": true,
"account_enforce_deal_floors": true,
"incomingRequest": {
"ortbRequest": {
"id": "request-id",
"site": {
"page": "test.somepage.com"
},
"imp": [
{
"id": "imp-id",
"video": {
"mimes": [
"video/mp4"
]
},
"bidfloor": 20,
"bidfloorcur": "USD",
"ext": {
"prebid": {
"bidder": {
"appnexus": {
"placementId": 1
},
"pubmatic": {
"publisherId": "1234"
}
}
}
}
}
],
"ext": {
"prebid": {
"floors": {
"enabled": true,
"enforcement": {
"floordeals": true,
"enforcerate": 100
}
}
}
}
}
},
"outgoingRequests": {
"appnexus": {
"mockResponse": {
"pbsSeatBids": [
{
"pbsBids": [
{
"ortbBid": {
"id": "apnx-bid-id",
"dealid": "apnx-deal-id",
"impid": "imp-id",
"price": 5,
"w": 200,
"h": 250,
"crid": "creative-1"
}
}
],
"seat": "appnexus",
"currency": "USD"
}
]
}
},
"pubmatic": {
"mockResponse": {
"pbsSeatBids": [
{
"pbsBids": [
{
"ortbBid": {
"id": "pubm-bid-id",
"impid": "imp-id",
"price": 10,
"w": 200,
"h": 250,
"crid": "creative-1"
}
}
],
"seat": "pubmatic",
"currency": "USD"
}
]
}
}
},
"response": {
"bids": {},
"ext": {
"prebid": {
"seatnonbid": [
{
"nonbid": [
{
"impid": "imp-id",
"statuscode": 304,
"ext": {
"prebid": {
"bid": {
"price": 5,
"w": 200,
"h": 250,
"crid": "creative-1",
"origbidcpm": 5,
"dealid": "apnx-deal-id"
}
}
}
}
],
"seat": "appnexus",
"ext": null
},
{
"nonbid": [
{
"impid": "imp-id",
"statuscode": 301,
"ext": {
"prebid": {
"bid": {
"price": 10,
"w": 200,
"h": 250,
"crid": "creative-1",
"origbidcpm": 10
}
}
}
}
],
"seat": "pubmatic",
"ext": null
}
]
}
}
}
}
31 changes: 30 additions & 1 deletion exchange/exchangetest/floors_enforcement.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,35 @@
]
}
]
},
"ext": {
"prebid": {
"seatnonbid": [
{
"nonbid": [
{
"impid": "my-imp-id",
"statuscode": 301,
ashishshinde-pubm marked this conversation as resolved.
Show resolved Hide resolved
"ext": {
"prebid": {
"bid": {
"price": 7,
"w": 200,
"h": 250,
"origbidcpm": 7,
"cat": [
"IAB1-1"
]
}
}
}
}
],
"seat": "audienceNetwork",
"ext": null
}
]
}
}
}
}
}
2 changes: 2 additions & 0 deletions exchange/non_bid_reason.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ type NonBidReason int
const (
NoBidUnknownError NonBidReason = 0 // No Bid - General
ResponseRejectedGeneral NonBidReason = 300
ResponseRejectedBelowFloor NonBidReason = 301 // Response Rejected - Below Floor
ResponseRejectedCategoryMappingInvalid NonBidReason = 303 // Response Rejected - Category Mapping Invalid
ResponseRejectedBelowDealFloor NonBidReason = 304 // Response Rejected - Bid was Below Deal Floor
ResponseRejectedCreativeSizeNotAllowed NonBidReason = 351 // Response Rejected - Invalid Creative (Size Not Allowed)
ResponseRejectedCreativeNotSecure NonBidReason = 352 // Response Rejected - Invalid Creative (Not Secure)
)
Expand Down
Loading