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

AppNexus: reform bid floor handling #1814

Merged
merged 2 commits into from
Apr 26, 2021
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
2 changes: 1 addition & 1 deletion adapters/appnexus/appnexus.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func preprocess(imp *openrtb2.Imp, defaultDisplayManagerVer string) (string, err
if appnexusExt.InvCode != "" {
imp.TagID = appnexusExt.InvCode
}
if appnexusExt.Reserve > 0 {
if imp.BidFloor <= 0 && appnexusExt.Reserve > 0 {
SyntaxNode marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't validate the BidFloor in the original request. Would it be better to just check for 0 to be sure it omitted rather than explicitly set to a nonsensical value?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since a negative value would anyway be invalid, this check makes sense to me

imp.BidFloor = appnexusExt.Reserve // This will be broken for non-USD currency.
}
if imp.Banner != nil {
Expand Down
144 changes: 144 additions & 0 deletions adapters/appnexus/appnexustest/supplemental/reserve-ignored.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
},
{
"w": 300,
"h": 600
}
]
},
"bidfloor": 0.3,
"ext": {
"bidder": {
"placement_id": 1,
"reserve": 0.4
}
}
}
]
},

"httpCalls": [
{
"expectedRequest": {
"uri": "http://ib.adnxs.com/openrtb2",
"body": {
"id": "test-request-id",
"ext": {
"appnexus": {
"hb_source": 5
},
"prebid": {}
},
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
},
{
"w": 300,
"h": 600
}
],
"w": 300,
"h": 250
},
"bidfloor": 0.3,
"ext": {
"appnexus": {
"placement_id": 1
}
}
}
]
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "958",
"bid": [{
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.500000,
"adid": "29681110",
"adm": "some-test-ad",
"adomain": ["appnexus.com"],
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110",
"cid": "958",
"crid": "29681110",
"h": 250,
"w": 300,
"ext": {
"appnexus": {
"brand_id": 1,
"brand_category_id": 1,
"auction_id": 8189378542222915032,
"bid_ad_type": 0,
"bidder_id": 2,
"ranking_price": 0.000000,
"deal_priority": 5
}
}
}]
}
],
"bidid": "5778926625248726496",
"cur": "USD"
}
}
}
],

"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.5,
"adm": "some-test-ad",
"adid": "29681110",
"adomain": ["appnexus.com"],
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110",
"cid": "958",
"crid": "29681110",
"w": 300,
"h": 250,
"cat": ["IAB20-3"],
"ext": {
"appnexus": {
"brand_id": 1,
"brand_category_id": 1,
"auction_id": 8189378542222915032,
"bid_ad_type": 0,
"bidder_id": 2,
"ranking_price": 0.000000,
"deal_priority": 5
}
}
},
"type": "banner"
}
]
}
]
}
143 changes: 143 additions & 0 deletions adapters/appnexus/appnexustest/supplemental/reserve-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
},
{
"w": 300,
"h": 600
}
]
},
"ext": {
"bidder": {
"placement_id": 1,
"reserve": 0.4
}
}
}
]
},

"httpCalls": [
{
"expectedRequest": {
"uri": "http://ib.adnxs.com/openrtb2",
"body": {
"id": "test-request-id",
"ext": {
"appnexus": {
"hb_source": 5
},
"prebid": {}
},
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
},
{
"w": 300,
"h": 600
}
],
"w": 300,
"h": 250
},
"bidfloor": 0.4,
"ext": {
"appnexus": {
"placement_id": 1
}
}
}
]
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "958",
"bid": [{
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.500000,
"adid": "29681110",
"adm": "some-test-ad",
"adomain": ["appnexus.com"],
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110",
"cid": "958",
"crid": "29681110",
"h": 250,
"w": 300,
"ext": {
"appnexus": {
"brand_id": 1,
"brand_category_id": 1,
"auction_id": 8189378542222915032,
"bid_ad_type": 0,
"bidder_id": 2,
"ranking_price": 0.000000,
"deal_priority": 5
}
}
}]
}
],
"bidid": "5778926625248726496",
"cur": "USD"
}
}
}
],

"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.5,
"adm": "some-test-ad",
"adid": "29681110",
"adomain": ["appnexus.com"],
"iurl": "http://nym1-ib.adnxs.com/cr?id=29681110",
"cid": "958",
"crid": "29681110",
"w": 300,
"h": 250,
"cat": ["IAB20-3"],
"ext": {
"appnexus": {
"brand_id": 1,
"brand_category_id": 1,
"auction_id": 8189378542222915032,
"bid_ad_type": 0,
"bidder_id": 2,
"ranking_price": 0.000000,
"deal_priority": 5
}
}
},
"type": "banner"
}
]
}
]
}