Skip to content
Merged
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
31 changes: 30 additions & 1 deletion adapters/vungle/vungle.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,15 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
for i := range seatBid.Bid {
// NewsBreak Custom SDK Logic Begins
seatBid.Bid[i].Ext = extBytes
mediaType, err := getMediaTypeForImp(seatBid.Bid[i].ImpID, request.Imp)
if err != nil {
return nil, []error{err}
}
// NewsBreak Custom SDK Logic Ends

b := &adapters.TypedBid{
Bid: &seatBid.Bid[i],
BidType: openrtb_ext.BidTypeVideo,
BidType: mediaType,
Seat: openrtb_ext.BidderName(seatBid.Seat),
}

Expand All @@ -180,3 +184,28 @@ func getAdUnitIdForImp(imps []openrtb2.Imp) string {
}
return adUnitId
}

func getMediaTypeForImp(impId string, imps []openrtb2.Imp) (openrtb_ext.BidType, error) {
var mediaType openrtb_ext.BidType
var typeCnt = 0
for _, imp := range imps {
if imp.ID == impId {
if imp.Banner != nil {
typeCnt += 1
mediaType = openrtb_ext.BidTypeBanner
}
if imp.Native != nil {
typeCnt += 1
mediaType = openrtb_ext.BidTypeNative
}
if imp.Video != nil {
typeCnt += 1
mediaType = openrtb_ext.BidTypeVideo
}
}
}
if typeCnt == 1 {
return mediaType, nil
}
return mediaType, fmt.Errorf("Vungle unable to fetch mediaType in multi-format: %s", impId)
}