diff --git a/adapters/adyoulike/adyoulike.go b/adapters/adyoulike/adyoulike.go new file mode 100644 index 00000000000..9a137a41fef --- /dev/null +++ b/adapters/adyoulike/adyoulike.go @@ -0,0 +1,137 @@ +package adyoulike + +import ( + "encoding/json" + "errors" + "fmt" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" + "net/http" + + "github.com/buger/jsonparser" + "github.com/mxmCherry/openrtb" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/errortypes" +) + +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { + return &adapter{ + endpoint: config.Endpoint, + }, nil +} + +type adapter struct { + endpoint string +} + +func (a *adapter) MakeRequests( + openRTBRequest *openrtb.BidRequest, + reqInfo *adapters.ExtraRequestInfo, +) ( + requestsToBidder []*adapters.RequestData, + errs []error, +) { + var err error + var tagID string + + reqCopy := *openRTBRequest + reqCopy.Imp = []openrtb.Imp{} + for ind, imp := range openRTBRequest.Imp { + reqCopy.Imp = append(reqCopy.Imp, imp) + + tagID, err = jsonparser.GetString(reqCopy.Imp[ind].Ext, "bidder", "placement") + if err != nil { + errs = append(errs, err) + continue + } + + reqCopy.Imp[ind].TagID = tagID + } + + openRTBRequestJSON, err := json.Marshal(reqCopy) + if err != nil { + errs = append(errs, err) + } + + if len(errs) > 0 { + return nil, errs + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + headers.Add("x-openrtb-version", "2.5") + + requestToBidder := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: openRTBRequestJSON, + Headers: headers, + } + requestsToBidder = append(requestsToBidder, requestToBidder) + + return requestsToBidder, errs +} + +const unexpectedStatusCodeFormat = "" + + "Unexpected status code: %d. Run with request.debug = 1 for more info" + +func (a *adapter) MakeBids( + openRTBRequest *openrtb.BidRequest, + requestToBidder *adapters.RequestData, + bidderRawResponse *adapters.ResponseData, +) ( + bidderResponse *adapters.BidderResponse, + errs []error, +) { + switch bidderRawResponse.StatusCode { + case http.StatusOK: + break + case http.StatusNoContent: + return nil, []error{errors.New("MakeBids error: No Content")} + case http.StatusBadRequest: + err := &errortypes.BadInput{ + Message: fmt.Sprintf(unexpectedStatusCodeFormat, bidderRawResponse.StatusCode), + } + return nil, []error{err} + default: + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf(unexpectedStatusCodeFormat, bidderRawResponse.StatusCode), + } + return nil, []error{err} + } + + var openRTBBidderResponse openrtb.BidResponse + if err := json.Unmarshal(bidderRawResponse.Body, &openRTBBidderResponse); err != nil { + return nil, []error{err} + } + + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(openRTBRequest.Imp)) + bidResponse.Currency = openRTBBidderResponse.Cur + for _, seatBid := range openRTBBidderResponse.SeatBid { + for idx := range seatBid.Bid { + b := &adapters.TypedBid{ + Bid: &seatBid.Bid[idx], + BidType: getMediaTypeForImp(seatBid.Bid[idx].ImpID, openRTBRequest.Imp), + } + bidResponse.Bids = append(bidResponse.Bids, b) + } + } + return bidResponse, nil +} + +// getMediaTypeForBid determines which type of bid. +func getMediaTypeForImp(impID string, imps []openrtb.Imp) openrtb_ext.BidType { + mediaType := openrtb_ext.BidTypeBanner + for _, imp := range imps { + if imp.ID == impID { + if imp.Banner == nil && imp.Video != nil { + mediaType = openrtb_ext.BidTypeVideo + } else if imp.Banner == nil && imp.Native != nil { + mediaType = openrtb_ext.BidTypeNative + } + } + } + + return mediaType +} diff --git a/adapters/adyoulike/adyoulike_test.go b/adapters/adyoulike/adyoulike_test.go new file mode 100644 index 00000000000..9ab689f3c77 --- /dev/null +++ b/adapters/adyoulike/adyoulike_test.go @@ -0,0 +1,22 @@ +package adyoulike + +import ( + "testing" + + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" +) + +const testsBidderEndpoint = "https://localhost/bid/4" + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderAdyoulike, config.Adapter{ + Endpoint: testsBidderEndpoint}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "adyouliketest", bidder) +} diff --git a/adapters/adyoulike/adyouliketest/exemplary/multiformat-impression.json b/adapters/adyoulike/adyouliketest/exemplary/multiformat-impression.json new file mode 100644 index 00000000000..2ae99c04969 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/exemplary/multiformat-impression.json @@ -0,0 +1,169 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + }, + { + "id": "video-imp-id", + "video": { + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "placement": "54321" + } + } + }, + { + "id": "native-imp-id", + "native": { + "title": "required" + }, + "ext": { + "bidder": { + "placement": "123123" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + }, + { + "ext": { + "bidder": { + "placement": "54321" + } + }, + "id": "video-imp-id", + "tagid": "54321", + "video": { + "h": 480, + "mimes": null, + "w": 640 + } + }, + { + "ext": { + "bidder": { + "placement": "123123" + } + }, + "id": "native-imp-id", + "native": { + "request": "" + }, + "tagid": "123123" + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-response-id", + "seatbid": [{ + "seat": "1", + "bid": [{ + "id": "12340", + "impid": "banner-imp-id", + "price": 300, + "adm": "%3C%3Fxml%20version%3D%221.0%22%20encod%2Fhtml%3E", + "nurl": "http://example.com/winnoticeurl0" + }, + { + "id": "12341", + "impid": "video-imp-id", + "price": 301, + "adm": "%3C%3Fxml%20version%3D%221.0%22%20encod%2FVAST%3E", + "nurl": "http://example.com/winnoticeurl1" + }, + { + "id": "12342", + "impid": "native-imp-id", + "price": 302, + "adm": "{'json':'response','for':'native'}", + "nurl": "http://example.com/winnoticeurl2" + } + ] + }] + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "12340", + "impid": "banner-imp-id", + "price": 300, + "nurl": "http://example.com/winnoticeurl0", + "adm": "%3C%3Fxml%20version%3D%221.0%22%20encod%2Fhtml%3E" + }, + "type": "banner" + }, + { + "bid": { + "id": "12341", + "impid": "video-imp-id", + "price": 301, + "nurl": "http://example.com/winnoticeurl1", + "adm": "%3C%3Fxml%20version%3D%221.0%22%20encod%2FVAST%3E" + }, + "type": "video" + }, + { + "bid": { + "id": "12342", + "impid": "native-imp-id", + "price": 302, + "nurl": "http://example.com/winnoticeurl2", + "adm": "{'json':'response','for':'native'}" + }, + "type": "native" + } + ] + } + ] + } diff --git a/adapters/adyoulike/adyouliketest/params/race/banner.json b/adapters/adyoulike/adyouliketest/params/race/banner.json new file mode 100644 index 00000000000..726ca878c05 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/params/race/banner.json @@ -0,0 +1,3 @@ +{ + "placement": "19f1b372c7548ec1fe734d2c9f8dc688" +} diff --git a/adapters/adyoulike/adyouliketest/params/race/video.json b/adapters/adyoulike/adyouliketest/params/race/video.json new file mode 100644 index 00000000000..d0883f5e04a --- /dev/null +++ b/adapters/adyoulike/adyouliketest/params/race/video.json @@ -0,0 +1,3 @@ +{ + "placement": "19f1b372c7548ec1fe734d2c9f8dc688" +} diff --git a/adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json b/adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json new file mode 100644 index 00000000000..b156dd65ae3 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/supplemental/invalid-bid-response.json @@ -0,0 +1,65 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": "" + } + } + ], + + "expectedBidResponses": [], + + "expectedMakeBidsErrors": [ + { + "value": "json: cannot unmarshal string into Go value of type openrtb.BidResponse", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adyoulike/adyouliketest/supplemental/status-bad-request.json b/adapters/adyoulike/adyouliketest/supplemental/status-bad-request.json new file mode 100644 index 00000000000..83b5f3611d8 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/supplemental/status-bad-request.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + } + ] + } + }, + "mockResponse": { + "status": 400, + "body": { + } + } + } + ], + + "expectedBidResponses": [], + + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adyoulike/adyouliketest/supplemental/status-no-content.json b/adapters/adyoulike/adyouliketest/supplemental/status-no-content.json new file mode 100644 index 00000000000..9ef51e88a41 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/supplemental/status-no-content.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + } + ] + } + }, + "mockResponse": { + "status": 204, + "body": { + } + } + } + ], + + "expectedBidResponses": [], + + "expectedMakeBidsErrors": [ + { + "value": "MakeBids error: No Content", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adyoulike/adyouliketest/supplemental/status-service-unavailable.json b/adapters/adyoulike/adyouliketest/supplemental/status-service-unavailable.json new file mode 100644 index 00000000000..2b5872a16f5 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/supplemental/status-service-unavailable.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + } + ] + } + }, + "mockResponse": { + "status": 503, + "body": { + } + } + } + ], + + "expectedBidResponses": [], + + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 503. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adyoulike/adyouliketest/supplemental/status-unknown.json b/adapters/adyoulike/adyouliketest/supplemental/status-unknown.json new file mode 100644 index 00000000000..0b9ce745dd9 --- /dev/null +++ b/adapters/adyoulike/adyouliketest/supplemental/status-unknown.json @@ -0,0 +1,66 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "banner-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://localhost/bid/4", + "body": { + "id": "test-request-id", + "imp": [ + { + "banner": { + "format": [ + { + "h": 250, + "w": 300 + } + ] + }, + "ext": { + "bidder": { + "placement": "12345" + } + }, + "id": "banner-imp-id", + "tagid": "12345" + } + ] + } + }, + "mockResponse": { + "status": 999, + "body": { + } + } + } + ], + + "expectedBidResponses": [], + + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 999. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adyoulike/params_test.go b/adapters/adyoulike/params_test.go new file mode 100644 index 00000000000..b57264b3dbd --- /dev/null +++ b/adapters/adyoulike/params_test.go @@ -0,0 +1,62 @@ +package adyoulike + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +// This file actually intends to test static/bidder-params/adyoulike.json +// +// These also validate the format of the external API: request.imp[i].ext.adyoulike + +// TestValidParams makes sure that the adyoulike schema accepts all imp.ext fields which we intend to support. +func TestValidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, validParam := range validParams { + if err := validator.Validate(openrtb_ext.BidderAdyoulike, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected adyoulike params: %s", validParam) + } + } +} + +// TestInvalidParams makes sure that the adyoulike schema rejects all the imp.ext fields we don't support. +func TestInvalidParams(t *testing.T) { + validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") + if err != nil { + t.Fatalf("Failed to fetch the json-schemas. %v", err) + } + + for _, invalidParam := range invalidParams { + if err := validator.Validate(openrtb_ext.BidderAdyoulike, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} + +var validParams = []string{ + `{"placement":"123"}`, + `{"placement":"123","campaign":"456"}`, + `{"placement":"123","campaign":"456","track":"789"}`, + `{"placement":"123","campaign":"456","track":"789","creative":"ABC"}`, + `{"placement":"123","campaign":"456","track":"789","creative":"ABC","source":"SSP"}`, + `{"placement":"123","campaign":"456","track":"789","creative":"ABC","source":"SSP","debug":"info"}`, +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{"invalid":"123"}`, + `{"placement":123}`, + `{"placement":"123","campaign":123}`, +} diff --git a/adapters/adyoulike/usersync.go b/adapters/adyoulike/usersync.go new file mode 100644 index 00000000000..0ecc4e405dc --- /dev/null +++ b/adapters/adyoulike/usersync.go @@ -0,0 +1,12 @@ +package adyoulike + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewAdyoulikeSyncer(urlTemplate *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("adyoulike", 259, urlTemplate, adapters.SyncTypeRedirect) +} diff --git a/adapters/adyoulike/usersync_test.go b/adapters/adyoulike/usersync_test.go new file mode 100644 index 00000000000..5090acb1a14 --- /dev/null +++ b/adapters/adyoulike/usersync_test.go @@ -0,0 +1,36 @@ +package adyoulike + +import ( + "testing" + "text/template" + + "github.com/stretchr/testify/assert" + + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" +) + +func TestAdyoulikeSyncer(t *testing.T) { + syncURL := "//visitor.omnitagjs.com/visitor/bsync?uid=19340f4f097d16f41f34fc0274981ca4&name=PrebidServer&gdpr_consent_string={{.GDPRConsent}}&gdpr={{.GDPR}}&us_privacy={{.USPrivacy}}" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + + syncer := NewAdyoulikeSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "1", + Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw", + }, + CCPA: ccpa.Policy{ + Consent: "1-YY", + }, + }) + + assert.NoError(t, err) + assert.Equal(t, "//visitor.omnitagjs.com/visitor/bsync?uid=19340f4f097d16f41f34fc0274981ca4&name=PrebidServer&gdpr_consent_string=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&gdpr=1&us_privacy=1-YY", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) + assert.EqualValues(t, 259, syncer.GDPRVendorID()) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/config/config.go b/config/config.go index 2abdd117d52..4ec29e51dda 100644 --- a/config/config.go +++ b/config/config.go @@ -577,6 +577,7 @@ func (cfg *Configuration) setDerivedDefaults() { setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdman, "https://sync.admanmedia.com/pbs.gif?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadman%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BUID%5D") // openrtb_ext.BidderAdOcean doesn't have a good default. setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdvangelists, "https://nep.advangelists.com/xp/user-sync?acctid={aid}&&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadvangelists%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdyoulike, "http://visitor.omnitagjs.com/visitor/bsync?uid=19340f4f097d16f41f34fc0274981ca4&name=PrebidServer&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadyoulike%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BBUYER_USERID%5D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAJA, "https://ad.as.amanad.adtdp.com/v1/sync/ssp?ssp=4&gdpr={{.GDPR}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Daja%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25s") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAMX, "https://prebid.a-mo.net/cchain/0?gdpr={{.GDPR}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Damx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAppnexus, "https://ib.adnxs.com/getuid?"+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadnxs%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") @@ -815,6 +816,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.adtarget.endpoint", "http://ghb.console.adtarget.com.tr/pbs/ortb") v.SetDefault("adapters.adtelligent.endpoint", "http://ghb.adtelligent.com/pbs/ortb") v.SetDefault("adapters.advangelists.endpoint", "http://nep.advangelists.com/xp/get?pubid={{.PublisherID}}") + v.SetDefault("adapters.adyoulike.endpoint", "https://broker-preprod.omnitagjs.com/broker/bid?partnerId=19340f4f097d16f41f34fc0274981ca4") v.SetDefault("adapters.aja.endpoint", "https://ad.as.amanad.adtdp.com/v1/bid/4") v.SetDefault("adapters.amx.endpoint", "http://pbs.amxrtb.com/auction/openrtb") v.SetDefault("adapters.applogy.endpoint", "http://rtb.applogy.com/v1/prebid") diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 8d0c0a4056c..46c967065cb 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -19,6 +19,7 @@ import ( "github.com/prebid/prebid-server/adapters/adtarget" "github.com/prebid/prebid-server/adapters/adtelligent" "github.com/prebid/prebid-server/adapters/advangelists" + "github.com/prebid/prebid-server/adapters/adyoulike" "github.com/prebid/prebid-server/adapters/aja" "github.com/prebid/prebid-server/adapters/amx" "github.com/prebid/prebid-server/adapters/applogy" @@ -126,6 +127,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { openrtb_ext.BidderAdtarget: adtarget.Builder, openrtb_ext.BidderAdtelligent: adtelligent.Builder, openrtb_ext.BidderAdvangelists: advangelists.Builder, + openrtb_ext.BidderAdyoulike: adyoulike.Builder, openrtb_ext.BidderAJA: aja.Builder, openrtb_ext.BidderAMX: amx.Builder, openrtb_ext.BidderApplogy: applogy.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 600e130b167..570701603fd 100755 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -90,6 +90,7 @@ const ( BidderAdtarget BidderName = "adtarget" BidderAdtelligent BidderName = "adtelligent" BidderAdvangelists BidderName = "advangelists" + BidderAdyoulike BidderName = "adyoulike" BidderAJA BidderName = "aja" BidderAMX BidderName = "amx" BidderApplogy BidderName = "applogy" @@ -197,6 +198,7 @@ func CoreBidderNames() []BidderName { BidderAdtarget, BidderAdtelligent, BidderAdvangelists, + BidderAdyoulike, BidderAJA, BidderAMX, BidderApplogy, diff --git a/openrtb_ext/imp_adyoulike.go b/openrtb_ext/imp_adyoulike.go new file mode 100644 index 00000000000..67a94123734 --- /dev/null +++ b/openrtb_ext/imp_adyoulike.go @@ -0,0 +1,18 @@ +package openrtb_ext + +// ExtImpAdyoulike defines the contract for bidrequest.imp[i].ext.adyoulike +type ExtImpAdyoulike struct { + // placementId, only mandatory field + PlacementId string `json:"placement"` + + // Id of the forced campaign + Campaign string `json:"campaign"` + // Id of the forced track + Track string `json:"track"` + // Id of the forced creative + Creative string `json:"creative"` + // Context of the campaign values [SSP|AdServer] + Source string `json:"source"` + // Abitrary Id used for debug purpose + Debug string `json:"debug"` +} diff --git a/static/bidder-info/adyoulike.yaml b/static/bidder-info/adyoulike.yaml new file mode 100644 index 00000000000..3f35aa5b038 --- /dev/null +++ b/static/bidder-info/adyoulike.yaml @@ -0,0 +1,9 @@ +maintainer: + email: "core@adyoulike.com" +modifyingVastXmlAllowed: true +capabilities: + site: + mediaTypes: + - banner + - video + - native diff --git a/static/bidder-params/adyoulike.json b/static/bidder-params/adyoulike.json new file mode 100644 index 00000000000..f426a0923d7 --- /dev/null +++ b/static/bidder-params/adyoulike.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "AdYouLike Adapter Params", + "description": "A schema which validates params accepted by the AdYouLike adapter", + "type": "object", + "properties": { + "placement": { + "type": "string", + "description": "Placement Id" + }, + "campaign": { + "type": "string", + "description": "Id of a forced campaign" + }, + "track": { + "type": "string", + "description": "Id of a forced Track" + }, + "creative": { + "type": "string", + "description": "Id of a forced creative" + }, + "source": { + "type": "string", + "description": "context of the campaign" + }, + "debug": { + "type": "string", + "description": "Abitrary id used for debug purpose" + } + }, + "required": ["placement"] +} \ No newline at end of file diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 72159ad6738..7467eb261fa 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -17,6 +17,7 @@ import ( "github.com/prebid/prebid-server/adapters/adtarget" "github.com/prebid/prebid-server/adapters/adtelligent" "github.com/prebid/prebid-server/adapters/advangelists" + "github.com/prebid/prebid-server/adapters/adyoulike" "github.com/prebid/prebid-server/adapters/aja" "github.com/prebid/prebid-server/adapters/amx" "github.com/prebid/prebid-server/adapters/appnexus" @@ -109,6 +110,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.BidderAdtarget, adtarget.NewAdtargetSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdtelligent, adtelligent.NewAdtelligentSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdvangelists, advangelists.NewAdvangelistsSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderAdyoulike, adyoulike.NewAdyoulikeSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAJA, aja.NewAJASyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAMX, amx.NewAMXSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAppnexus, appnexus.NewAppnexusSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 79530c867f7..9727a2d4e22 100755 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -26,6 +26,7 @@ func TestNewSyncerMap(t *testing.T) { string(openrtb_ext.BidderAdtarget): syncConfig, string(openrtb_ext.BidderAdtelligent): syncConfig, string(openrtb_ext.BidderAdvangelists): syncConfig, + string(openrtb_ext.BidderAdyoulike): syncConfig, string(openrtb_ext.BidderAJA): syncConfig, string(openrtb_ext.BidderAMX): syncConfig, string(openrtb_ext.BidderAppnexus): syncConfig,