Skip to content

Commit

Permalink
OpenX: return cat/dur for video bids (#3834)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurb9 authored Aug 6, 2024
1 parent 8b13ebc commit c50e264
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
16 changes: 14 additions & 2 deletions adapters/openx/openx.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,26 @@ func (a *OpenxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRe
for _, sb := range bidResp.SeatBid {
for i := range sb.Bid {
bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
Bid: &sb.Bid[i],
BidType: getMediaTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp),
Bid: &sb.Bid[i],
BidType: getMediaTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp),
BidVideo: getBidVideo(&sb.Bid[i]),
})
}
}
return bidResponse, nil
}

func getBidVideo(bid *openrtb2.Bid) *openrtb_ext.ExtBidPrebidVideo {
var primaryCategory string
if len(bid.Cat) > 0 {
primaryCategory = bid.Cat[0]
}
return &openrtb_ext.ExtBidPrebidVideo{
PrimaryCategory: primaryCategory,
Duration: int(bid.Dur),
}
}

// getMediaTypeForImp figures out which media type this bid is for.
//
// OpenX doesn't support multi-type impressions.
Expand Down
14 changes: 12 additions & 2 deletions adapters/openx/openxtest/exemplary/simple-video.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
"adm": "some-test-ad",
"crid": "crid_10",
"w": 1024,
"h": 576
"h": 576,
"cattax": 1,
"cat": ["IAB20"],
"dur": 30
}]
}
]
Expand All @@ -82,7 +85,14 @@
"adm": "some-test-ad",
"crid": "crid_10",
"w": 1024,
"h": 576
"h": 576,
"cattax": 1,
"cat": ["IAB20"],
"dur": 30
},
"video": {
"duration": 30,
"primary_category": "IAB20"
},
"type": "video"
}
Expand Down

0 comments on commit c50e264

Please sign in to comment.