@@ -36,6 +36,17 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
3636 for _ , imp := range request .Imp {
3737 requestCopy .Imp = []openrtb2.Imp {imp }
3838
39+ // NewsBreak Custom Prebid Code Starts
40+ tagId , err := extractTagId (& imp )
41+ if err != nil {
42+ errors = append (errors , fmt .Errorf ("extract tagId: %w" , err ))
43+ continue
44+ }
45+ for i , _ := range requestCopy .Imp {
46+ requestCopy .Imp [i ].TagID = tagId
47+ }
48+ // NewsBreak Custom Prebid Code Ends
49+
3950 requestJSON , err := json .Marshal (& requestCopy )
4051 if err != nil {
4152 errors = append (errors , fmt .Errorf ("marshal bidRequest: %w" , err ))
@@ -132,3 +143,16 @@ func extractCid(imp *openrtb2.Imp) (string, error) {
132143 }
133144 return strings .TrimSpace (impExt .ConnectionId ), nil
134145}
146+
147+ func extractTagId (imp * openrtb2.Imp ) (string , error ) {
148+ var bidderExt adapters.ExtImpBidder
149+ if err := jsonutil .Unmarshal (imp .Ext , & bidderExt ); err != nil {
150+ return "" , fmt .Errorf ("unmarshal bidderExt: %w" , err )
151+ }
152+
153+ var impExt openrtb_ext.ImpExtVidazoo
154+ if err := jsonutil .Unmarshal (bidderExt .Bidder , & impExt ); err != nil {
155+ return "" , fmt .Errorf ("unmarshal ImpExtVidazoo: %w" , err )
156+ }
157+ return strings .TrimSpace (impExt .TagId ), nil
158+ }
0 commit comments