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

OpenX adapter: Pass rewarded video flag #1290

Merged
merged 1 commit into from
May 13, 2020
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
8 changes: 8 additions & 0 deletions adapters/openx/openx.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ func preprocess(imp *openrtb.Imp, reqExt *openxReqExt) error {
}
}

if imp.Video != nil {
if bidderExt.Prebid != nil && bidderExt.Prebid.IsRewardedInventory == 1 {
imp.Video.Ext = json.RawMessage(`{"rewarded":1}`)
} else {
imp.Video.Ext = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why the setting to nil. Do you expect the caller to potentially fill this is out in an incompatible value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for reviewing. Wanted to be consistent and wipe video.ext in both rewarded/non-rewarded cases, as the same happens to imp.ext when customParams is missing.

The java version passes values only explicitly anyway, this change there is:
prebid/prebid-server-java#712

}
}

return nil
}

Expand Down
102 changes: 102 additions & 0 deletions adapters/openx/openxtest/exemplary/video-rewarded.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"video": {
"mimes": ["video/mp4"],
"protocols": [2, 5],
"w": 1024,
"h": 576,
"ext": {
"foo": "bar"
}
},
"instl": 1,
"ext": {
"bidder": {
"unit": "539439964",
"delDomain": "se-demo-d.openx.net"
},
"prebid": {
"is_rewarded_inventory": 1
}
}
}
]
},

"httpCalls": [
{
"expectedRequest": {
"uri": "http://rtb.openx.net/prebid",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"video": {
"mimes": ["video/mp4"],
"protocols": [2, 5],
"w": 1024,
"h": 576,
"ext": {
"rewarded": 1
}
},
"tagid": "539439964",
"instl": 1
}
],
"ext": {
"bc": "hb_pbs_1.0.0",
"delDomain": "se-demo-d.openx.net"
}
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"cur": "USD",
"seatbid": [
{
"seat": "openx",
"bid": [{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 0.500000,
"adm": "some-test-ad",
"crid": "crid_10",
"w": 1024,
"h": 576
}]
}
]
}
}
}
],


"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 0.5,
"adm": "some-test-ad",
"crid": "crid_10",
"w": 1024,
"h": 576
},
"type": "video"
}
]
}
]
}