diff --git a/adapters/ogury/ogury.go b/adapters/ogury/ogury.go new file mode 100644 index 0000000000..595a2dfb97 --- /dev/null +++ b/adapters/ogury/ogury.go @@ -0,0 +1,177 @@ +package ogury + +import ( + "encoding/json" + "fmt" + "net/http" + "strings" + + "github.com/prebid/openrtb/v20/openrtb2" + + "github.com/prebid/prebid-server/v3/adapters" + "github.com/prebid/prebid-server/v3/config" + "github.com/prebid/prebid-server/v3/errortypes" + "github.com/prebid/prebid-server/v3/openrtb_ext" + "github.com/prebid/prebid-server/v3/util/jsonutil" +) + +type adapter struct { + endpoint string +} + +func Builder(_ openrtb_ext.BidderName, config config.Adapter, _ config.Server) (adapters.Bidder, error) { + return &adapter{endpoint: config.Endpoint}, nil +} + +func (a adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + headers := buildHeaders(request) + + var errors []error + var impsWithOguryParams []openrtb2.Imp + for i, imp := range request.Imp { + var impExt, impExtBidderHoist map[string]json.RawMessage + // extract ext + if err := jsonutil.Unmarshal(imp.Ext, &impExt); err != nil { + return nil, append(errors, &errortypes.BadInput{ + Message: "Bidder extension not provided or can't be unmarshalled", + }) + } + // find Ogury bidder params + if bidder, ok := impExt[openrtb_ext.PrebidExtBidderKey]; ok { + if err := jsonutil.Unmarshal(bidder, &impExtBidderHoist); err != nil { + return nil, append(errors, &errortypes.BadInput{ + Message: "Ogury bidder extension not provided or can't be unmarshalled", + }) + } + } + + // extract every value from imp[].ext.bidder to imp[].ext + for key, value := range impExtBidderHoist { + impExt[key] = value + } + + ext, err := jsonutil.Marshal(impExt) + if err != nil { + return nil, append(errors, &errortypes.BadInput{ + Message: "Error while marshaling Imp.Ext bidder exension", + }) + } + request.Imp[i].Ext = ext + + // save adUnitCode + request.Imp[i].TagID = imp.ID + + // currency conversion + // Check if imp comes with bid floor amount defined in a foreign currency + if imp.BidFloor > 0 && imp.BidFloorCur != "" && strings.ToUpper(imp.BidFloorCur) != "USD" { + + // Convert to US dollars + convertedValue, err := requestInfo.ConvertCurrency(imp.BidFloor, imp.BidFloorCur, "USD") + if err != nil { + return nil, []error{err} + } + + // Update after conversion. All imp elements inside request.Imp are shallow copies + // therefore, their non-pointer values are not shared memory and are safe to modify. + request.Imp[i].BidFloorCur = "USD" + request.Imp[i].BidFloor = convertedValue + } + + // check if imp has ogury params and filter it + _, hasAssetKey := impExtBidderHoist["assetKey"] + _, hasAdUnitId := impExtBidderHoist["adUnitId"] + if hasAssetKey && hasAdUnitId { + impsWithOguryParams = append(impsWithOguryParams, request.Imp[i]) + } + } + + if len(impsWithOguryParams) == 0 && (request.Site == nil || request.Site.Publisher.ID == "") { + return nil, []error{&errortypes.BadInput{ + Message: "Invalid request. assetKey/adUnitId or request.site.publisher.id required", + }} + } else if len(impsWithOguryParams) > 0 && len(impsWithOguryParams) < len(request.Imp) { + request.Imp = impsWithOguryParams + } + + requestJSON, err := jsonutil.Marshal(request) + if err != nil { + return nil, []error{err} + } + + requestData := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: requestJSON, + Headers: headers, + ImpIDs: openrtb_ext.GetImpIDs(request.Imp), + } + + return []*adapters.RequestData{requestData}, nil + +} + +func buildHeaders(request *openrtb2.BidRequest) http.Header { + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + if request.Device != nil { + headers.Add("X-Forwarded-For", request.Device.IP) + headers.Add("X-Forwarded-For", request.Device.IPv6) + headers.Add("User-Agent", request.Device.UA) + headers.Add("Accept-Language", request.Device.Language) + } + return headers + +} + +func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) { + switch bid.MType { + case openrtb2.MarkupBanner: + return openrtb_ext.BidTypeBanner, nil + case openrtb2.MarkupAudio: + return openrtb_ext.BidTypeAudio, nil + case openrtb2.MarkupNative: + return openrtb_ext.BidTypeNative, nil + case openrtb2.MarkupVideo: + return openrtb_ext.BidTypeVideo, nil + default: + return "", &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Unsupported MType \"%d\", for impression \"%s\"", bid.MType, bid.ImpID), + } + } +} + +func (a adapter) MakeBids(request *openrtb2.BidRequest, _ *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { + if adapters.IsResponseStatusCodeNoContent(responseData) { + return nil, nil + } + if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil { + return nil, []error{err} + } + + var response openrtb2.BidResponse + if err := jsonutil.Unmarshal(responseData.Body, &response); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) + bidResponse.Currency = response.Cur + var errors []error + for _, seatBid := range response.SeatBid { + for i, bid := range seatBid.Bid { + bidType, err := getMediaTypeForBid(bid) + if err != nil { + errors = append(errors, err) + continue + } + bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ + Bid: &seatBid.Bid[i], + BidType: bidType, + }) + } + } + if errors != nil { + return nil, errors + } + + return bidResponse, nil +} diff --git a/adapters/ogury/ogury_test.go b/adapters/ogury/ogury_test.go new file mode 100644 index 0000000000..504be6ccaa --- /dev/null +++ b/adapters/ogury/ogury_test.go @@ -0,0 +1,21 @@ +package ogury + +import ( + "testing" + + "github.com/prebid/prebid-server/v3/adapters/adapterstest" + "github.com/prebid/prebid-server/v3/config" + "github.com/prebid/prebid-server/v3/openrtb_ext" +) + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderOgury, config.Adapter{ + Endpoint: "http://ogury.example.com"}, + config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "ogurytest", bidder) +} diff --git a/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json new file mode 100644 index 0000000000..99b58b3d3c --- /dev/null +++ b/adapters/ogury/ogurytest/exemplary/banner_asset_ad_unit.json @@ -0,0 +1,93 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "ad-unit-code-as-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "test-request-id", + "imp": [ + { + "id":"ad-unit-code-as-imp-id", + "tagid": "ad-unit-code-as-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "assetKey": "OGY", + "adUnitId": "123", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + } + } + } + ] + }, + "impIDs":["ad-unit-code-as-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "ad-unit-code-as-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "ad-unit-code-as-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json new file mode 100644 index 0000000000..ea39fb40c3 --- /dev/null +++ b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_with_params.json @@ -0,0 +1,139 @@ +{ + "mockBidRequest": { + "id": "filter-imp-without-ogury-params", + "site": { + "publisher": { + "id": "pub123" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + } + } + }, + { + "id": "test-imp-id-2", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": {"bidder": {}} + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [{"w": 1, "h": 1}] + }, + "ext": { + "gpid": "global position id", + "bidder": { + "assetKey": "OGY3", + "adUnitId": "1234" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "filter-imp-without-ogury-params", + "site": { + "publisher": { + "id": "pub123" + } + }, + "imp": [ + { + "id":"test-imp-id", + "tagid": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "assetKey": "OGY", + "adUnitId": "123", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + } + } + }, + { + "id":"test-imp-id-3", + "tagid": "test-imp-id-3", + "banner": { + "format": [{"w": 1, "h": 1}] + }, + "ext": { + "gpid": "global position id", + "assetKey": "OGY3", + "adUnitId": "1234", + "bidder": { + "assetKey": "OGY3", + "adUnitId": "1234" + } + } + } + ] + }, + "impIDs":["test-imp-id", "test-imp-id-3"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json new file mode 100644 index 0000000000..83a5be5a31 --- /dev/null +++ b/adapters/ogury/ogurytest/exemplary/banner_multi_imp_without_ogury_params.json @@ -0,0 +1,108 @@ +{ + "mockBidRequest": { + "id": "every-imp-without-param-dont-filter-imps", + "site": { + "publisher": { + "id": "pub123" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id" + } + }, + { + "id": "test-imp-id-2", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": {} + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "every-imp-without-param-dont-filter-imps", + "site": { + "publisher": { + "id": "pub123" + } + }, + "imp": [ + { + "id":"test-imp-id", + "tagid": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id" + } + }, + { + "id": "test-imp-id-2", + "tagid": "test-imp-id-2", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": {} + } + ] + }, + "impIDs":["test-imp-id", "test-imp-id-2"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ogury/ogurytest/exemplary/banner_publisher.json b/adapters/ogury/ogurytest/exemplary/banner_publisher.json new file mode 100644 index 0000000000..4450049950 --- /dev/null +++ b/adapters/ogury/ogurytest/exemplary/banner_publisher.json @@ -0,0 +1,93 @@ +{ + "mockBidRequest": { + "id": "test-publiser-id", + "site": { + "publisher": { + "id": "pub123" + } + }, + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id" + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "test-publiser-id", + "site": { + "publisher": { + "id": "pub123" + } + }, + "imp": [ + { + "id":"test-imp-id", + "tagid": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id" + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-publiser-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ogury/ogurytest/supplemental/banner_invalid_request.json b/adapters/ogury/ogurytest/supplemental/banner_invalid_request.json new file mode 100644 index 0000000000..aac99257c2 --- /dev/null +++ b/adapters/ogury/ogurytest/supplemental/banner_invalid_request.json @@ -0,0 +1,24 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "bidder": {} + } + } + ] + }, + + "httpCalls": [], + "expectedBidResponses": [], + "expectedMakeRequestsErrors": [{ + "value": "Invalid request. assetKey/adUnitId or request.site.publisher.id required", + "comparison": "literal" + }] +} diff --git a/adapters/ogury/ogurytest/supplemental/banner_with_ad_unit_code.json b/adapters/ogury/ogurytest/supplemental/banner_with_ad_unit_code.json new file mode 100644 index 0000000000..f77774dfbf --- /dev/null +++ b/adapters/ogury/ogurytest/supplemental/banner_with_ad_unit_code.json @@ -0,0 +1,99 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + }, + "prebid": { + "adunitcode": "ad-unit-code" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "test-request-id", + "imp": [ + { + "id":"test-imp-id", + "tagid": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "assetKey": "OGY", + "adUnitId": "123", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123" + }, + "prebid": { + "adunitcode": "ad-unit-code" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json b/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json new file mode 100644 index 0000000000..6674d4dbac --- /dev/null +++ b/adapters/ogury/ogurytest/supplemental/banner_with_arbitary_bidder_param.json @@ -0,0 +1,96 @@ +{ + "mockBidRequest": { + "id": "every-param-in-imp.ext.bidder-is-hoisted-to-imp.ext", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123", + "testcampaign": "test123" + } + } + } + ] + }, + + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://ogury.example.com", + "body": { + "id": "every-param-in-imp.ext.bidder-is-hoisted-to-imp.ext", + "imp": [ + { + "id":"test-imp-id", + "tagid": "test-imp-id", + "banner": { + "format": [{"w": 128, "h": 100}] + }, + "ext": { + "gpid": "global position id", + "assetKey": "OGY", + "adUnitId": "123", + "testcampaign": "test123", + "bidder": { + "assetKey": "OGY", + "adUnitId": "123", + "testcampaign": "test123" + } + } + } + ] + }, + "impIDs":["test-imp-id"] + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "cur": "USD", + "seatbid": [ + { + "seat": "seat", + "bid": [{ + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.500000, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }] + } + ] + } + } + } + ], + + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "some-UUID", + "impid": "test-imp-id", + "price": 0.5, + "adm": "adm string", + "crid": "crid_10", + "h": 100, + "w": 128, + "mtype": 1 + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ogury/param_test.go b/adapters/ogury/param_test.go new file mode 100644 index 0000000000..f4c7c83445 --- /dev/null +++ b/adapters/ogury/param_test.go @@ -0,0 +1,50 @@ +package ogury + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/v3/openrtb_ext" +) + +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range validParams { + if err := validator.Validate(openrtb_ext.BidderOgury, json.RawMessage(p)); err != nil { + t.Errorf("Schema rejected valid params: %s", p) + } + } +} + +var validParams = []string{ + `{}`, + `{"adUnitId": "12", "assetKey": "OGY"}`, + `{"adUnitId": "123", "assetKey": "OGY", "thirdParam": "something"}`, +} + +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json schema. %v", err) + } + + for _, p := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderOgury, json.RawMessage(p)); err == nil { + t.Errorf("Schema allowed invalid params: %s", p) + } + } +} + +var invalidParams = []string{ + ``, + `null`, + `[]`, + `{"adUnitId": "test 12"}`, + `{"assetKey": "ogy asset"}`, + `{"adUnitId": 12, "assetKey": "OGY"}`, + `{"adUnitId": "45test", "assetKey": false}`, +} diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 97a03dde2a..4af5bff3a9 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -145,6 +145,7 @@ import ( "github.com/prebid/prebid-server/v3/adapters/nativo" "github.com/prebid/prebid-server/v3/adapters/nextmillennium" "github.com/prebid/prebid-server/v3/adapters/nobid" + "github.com/prebid/prebid-server/v3/adapters/ogury" "github.com/prebid/prebid-server/v3/adapters/oms" "github.com/prebid/prebid-server/v3/adapters/onetag" "github.com/prebid/prebid-server/v3/adapters/openweb" @@ -378,6 +379,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderNativo: nativo.Builder, openrtb_ext.BidderNextMillennium: nextmillennium.Builder, openrtb_ext.BidderNoBid: nobid.Builder, + openrtb_ext.BidderOgury: ogury.Builder, openrtb_ext.BidderOms: oms.Builder, openrtb_ext.BidderOneTag: onetag.Builder, openrtb_ext.BidderOpenWeb: openweb.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index fd7893a5a5..769dcc5d7f 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -163,6 +163,7 @@ var coreBidderNames []BidderName = []BidderName{ BidderNativo, BidderNextMillennium, BidderNoBid, + BidderOgury, BidderOms, BidderOneTag, BidderOpenWeb, @@ -500,6 +501,7 @@ const ( BidderNativo BidderName = "nativo" BidderNextMillennium BidderName = "nextmillennium" BidderNoBid BidderName = "nobid" + BidderOgury BidderName = "ogury" BidderOms BidderName = "oms" BidderOneTag BidderName = "onetag" BidderOpenWeb BidderName = "openweb" diff --git a/openrtb_ext/imp_ogury.go b/openrtb_ext/imp_ogury.go new file mode 100644 index 0000000000..295bd7d26d --- /dev/null +++ b/openrtb_ext/imp_ogury.go @@ -0,0 +1,6 @@ +package openrtb_ext + +type ImpExtOgury struct { + AdUnitID string `json:"adUnitId,omitempty"` + AssetKey string `json:"assetKey,omitempty"` +} diff --git a/static/bidder-info/ogury.yaml b/static/bidder-info/ogury.yaml new file mode 100644 index 0000000000..a28a767a7a --- /dev/null +++ b/static/bidder-info/ogury.yaml @@ -0,0 +1,16 @@ +endpoint: "http://prebids2s.presage.io/api/header-bidding-request" +endpointCompression: gzip +geoscope: + - global +maintainer: + email: deliveryservices@ogury.co +gvlVendorID: 31 +modifyingVastXmlAllowed: true +capabilities: + site: + mediaTypes: + - banner +userSync: + iframe: + url: "https://ms-cookie-sync.presage.io/user-sync.html?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}&source=prebids2s" + userMacro: "{{OGURY_UID}}" diff --git a/static/bidder-params/ogury.json b/static/bidder-params/ogury.json new file mode 100644 index 0000000000..fd77fbe849 --- /dev/null +++ b/static/bidder-params/ogury.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Ogury Adapter Params", + "description": "A schema which validates params accepted by the Ogury adapter", + "type": "object", + + "properties": { + "assetKey": { + "type": "string", + "minLength": 1, + "description": "Ogury provided id for you site." + }, + "adUnitId": { + "type": "string", + "minLength": 1, + "description": "Ogury provided id for you placement." + } + }, + + "allOf": [ + { + "if": { "required": ["assetKey"] }, + "then": { "required": ["adUnitId"] } + }, + { + "if": { "required": ["adUnitId"] }, + "then": { "required": ["assetKey"] } + } + ] +}