Skip to content
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
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
Loading