diff --git a/adapters/adagio/adagio.go b/adapters/adagio/adagio.go new file mode 100644 index 00000000000..0da4d6ac9e4 --- /dev/null +++ b/adapters/adagio/adagio.go @@ -0,0 +1,139 @@ +package adagio + +import ( + "bytes" + "compress/gzip" + "encoding/json" + "fmt" + "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/errortypes" + "github.com/prebid/prebid-server/openrtb_ext" + "net/http" +) + +// Builder builds a new instance of the Adagio adapter for the given bidder with the given config. +func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) { + bidder := &adapter{ + endpoint: config.Endpoint, + } + return bidder, nil +} + +type adapter struct { + endpoint string +} + +type extBid struct { + Prebid *openrtb_ext.ExtBidPrebid +} + +// MakeRequests prepares the HTTP requests which should be made to fetch bids. +func (a *adapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + json, err := json.Marshal(request) + if err != nil { + return nil, []error{err} + } + + headers := http.Header{} + headers.Add("Content-Type", "application/json;charset=utf-8") + headers.Add("Accept", "application/json") + + if request.Device != nil { + if len(request.Device.IPv6) > 0 { + headers.Add("X-Forwarded-For", request.Device.IPv6) + } + if len(request.Device.IP) > 0 { + headers.Add("X-Forwarded-For", request.Device.IP) + } + } + + if request.Test == 0 { + // Gzip the body + // Note: Gzipping could be handled natively later: https://github.com/prebid/prebid-server/issues/1812 + var bodyBuf bytes.Buffer + gz := gzip.NewWriter(&bodyBuf) + if _, err = gz.Write(json); err == nil { + if err = gz.Close(); err == nil { + json = bodyBuf.Bytes() + headers.Add("Content-Encoding", "gzip") + // /!\ Go already sets the `Accept-Encoding: gzip` header. Never add it manually, or Go won't decompress the response. + //headers.Add("Accept-Encoding", "gzip") + } + } + } + + requestToBidder := &adapters.RequestData{ + Method: "POST", + Uri: a.endpoint, + Body: json, + Headers: headers, + } + + return []*adapters.RequestData{requestToBidder}, nil +} + +const unexpectedStatusCodeFormat = "Unexpected status code: %d. Run with request.debug = 1 for more info" + +// MakeBids unpacks the server's response into Bids. +func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, _ *adapters.RequestData, response *adapters.ResponseData) (*adapters.BidderResponse, []error) { + switch response.StatusCode { + case http.StatusOK: + break + case http.StatusNoContent: + return nil, nil + case http.StatusServiceUnavailable: + fallthrough + case http.StatusBadRequest: + fallthrough + case http.StatusUnauthorized: + fallthrough + case http.StatusForbidden: + err := &errortypes.BadInput{ + Message: fmt.Sprintf(unexpectedStatusCodeFormat, response.StatusCode), + } + return nil, []error{err} + default: + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf(unexpectedStatusCodeFormat, response.StatusCode), + } + return nil, []error{err} + } + + var openRTBBidderResponse openrtb2.BidResponse + if err := json.Unmarshal(response.Body, &openRTBBidderResponse); err != nil { + return nil, []error{err} + } + + bidsCapacity := len(internalRequest.Imp) + errs := make([]error, 0, bidsCapacity) + bidderResponse := adapters.NewBidderResponseWithBidsCapacity(bidsCapacity) + var typedBid *adapters.TypedBid + for _, seatBid := range openRTBBidderResponse.SeatBid { + for _, bid := range seatBid.Bid { + activeBid := bid + + activeExt := &extBid{} + if err := json.Unmarshal(activeBid.Ext, activeExt); err != nil { + errs = append(errs, err) + } + + var bidType openrtb_ext.BidType + if activeExt.Prebid != nil && activeExt.Prebid.Type != "" { + bidType = activeExt.Prebid.Type + } else { + err := &errortypes.BadServerResponse{ + Message: fmt.Sprintf("Failed to find native/banner/video mediaType \"%s\" ", activeBid.ImpID), + } + errs = append(errs, err) + continue + } + + typedBid = &adapters.TypedBid{Bid: &activeBid, BidType: bidType} + bidderResponse.Bids = append(bidderResponse.Bids, typedBid) + } + } + + return bidderResponse, nil +} diff --git a/adapters/adagio/adagio_test.go b/adapters/adagio/adagio_test.go new file mode 100644 index 00000000000..d5e25c7836d --- /dev/null +++ b/adapters/adagio/adagio_test.go @@ -0,0 +1,75 @@ +package adagio + +import ( + "encoding/json" + "github.com/mxmCherry/openrtb/v15/openrtb2" + "github.com/stretchr/testify/assert" + "testing" + + "github.com/prebid/prebid-server/adapters/adapterstest" + "github.com/prebid/prebid-server/config" + "github.com/prebid/prebid-server/openrtb_ext" +) + +func buildFakeBidRequest() openrtb2.BidRequest { + imp1 := openrtb2.Imp{ + ID: "some-impression-id", + Banner: &openrtb2.Banner{}, + Ext: json.RawMessage(`{"bidder": {"organizationId": "1000", "site": "site-name", "placement": "ban_atf"}}`), + } + + fakeBidRequest := openrtb2.BidRequest{ + ID: "some-request-id", + Imp: []openrtb2.Imp{imp1}, + } + + return fakeBidRequest +} + +func TestJsonSamples(t *testing.T) { + bidder, buildErr := Builder(openrtb_ext.BidderAdagio, config.Adapter{ + Endpoint: "http://localhost/prebid_server"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + adapterstest.RunJSONBidderTest(t, "adagiotest", bidder) +} + +func TestMakeRequests_NoGzip(t *testing.T) { + fakeBidRequest := buildFakeBidRequest() + fakeBidRequest.Test = 1 // Do not use Gzip in Test Mode. + + bidder, buildErr := Builder(openrtb_ext.BidderAdagio, config.Adapter{ + Endpoint: "http://localhost/prebid_server"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + requestData, errs := bidder.MakeRequests(&fakeBidRequest, nil) + + assert.Nil(t, errs) + assert.Equal(t, 1, len(requestData)) + + body := &openrtb2.BidRequest{} + err := json.Unmarshal(requestData[0].Body, body) + assert.NoError(t, err, "Request body unmarshalling error should be nil") + assert.Equal(t, 1, len(body.Imp)) +} + +func TestMakeRequests_Gzip(t *testing.T) { + fakeBidRequest := buildFakeBidRequest() + + bidder, buildErr := Builder(openrtb_ext.BidderAdagio, config.Adapter{ + Endpoint: "http://localhost/prebid_server"}) + + if buildErr != nil { + t.Fatalf("Builder returned unexpected error %v", buildErr) + } + + requestData, errs := bidder.MakeRequests(&fakeBidRequest, nil) + assert.Empty(t, errs, "Got errors while making requests") + assert.Equal(t, []string{"gzip"}, requestData[0].Headers["Content-Encoding"]) +} diff --git a/adapters/adagio/adagiotest/exemplary/banner-web.json b/adapters/adagio/adagiotest/exemplary/banner-web.json new file mode 100644 index 00000000000..732b40d2c1d --- /dev/null +++ b/adapters/adagio/adagiotest/exemplary/banner-web.json @@ -0,0 +1,155 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adagio": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/adagio/adagiotest/exemplary/multi-format.json b/adapters/adagio/adagiotest/exemplary/multi-format.json new file mode 100644 index 00000000000..85e0be26131 --- /dev/null +++ b/adapters/adagio/adagiotest/exemplary/multi-format.json @@ -0,0 +1,165 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "multi-format-id", + "banner": { + "w":320, + "h":50 + }, + "video": { + "mimes": ["video\/mp4"], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "multi-format-id", + "banner": { + "w":320, + "h":50 + }, + "video": { + "mimes": ["video\/mp4"], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "multi-format-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adagio": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "multi-format-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/adagio/adagiotest/exemplary/multi-imp.json b/adapters/adagio/adagiotest/exemplary/multi-imp.json new file mode 100644 index 00000000000..66af28ea559 --- /dev/null +++ b/adapters/adagio/adagiotest/exemplary/multi-imp.json @@ -0,0 +1,222 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "banner-impression-id", + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + }, + { + "id": "video-impression-id", + "video": { + "mimes": ["video\/mp4"], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "banner-impression-id", + "banner": { + "w":320, + "h":50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + }, + { + "id": "video-impression-id", + "video": { + "mimes": ["video\/mp4"], + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "banner-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + { + "id": "b4ae1b4e2fc24a4fb45540082e98e162", + "impid": "video-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 640, + "h": 480, + "ext": { + "prebid": { + "type": "video" + } + } + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adagio": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "banner-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 320, + "h": 50, + "ext": { + "prebid": { + "type": "banner" + } + } + }, + "type": "banner" + }, + { + "bid": { + "id": "b4ae1b4e2fc24a4fb45540082e98e162", + "impid": "video-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "w": 640, + "h": 480, + "ext": { + "prebid": { + "type": "video" + } + } + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/adagio/adagiotest/exemplary/native-web.json b/adapters/adagio/adagiotest/exemplary/native-web.json new file mode 100644 index 00000000000..0085aaddc64 --- /dev/null +++ b/adapters/adagio/adagiotest/exemplary/native-web.json @@ -0,0 +1,151 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ipv6": "2607:fb90:f27:4512:d800:cb23:a603:e245", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "2607:fb90:f27:4512:d800:cb23:a603:e245" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ipv6": "2607:fb90:f27:4512:d800:cb23:a603:e245", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "native": { + "ver":"1.1", + "request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}" + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "ext": { + "prebid": { + "type": "native" + } + } + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "acuityads": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids":[ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "crid": "20", + "adomain": [ + "awesome.com" + ], + "ext": { + "prebid": { + "type": "native" + } + } + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/adagio/adagiotest/exemplary/video-web.json b/adapters/adagio/adagiotest/exemplary/video-web.json new file mode 100644 index 00000000000..353420ee962 --- /dev/null +++ b/adapters/adagio/adagiotest/exemplary/video-web.json @@ -0,0 +1,175 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video\/mp4" + ], + "w": 640, + "h": 480, + "minduration": 120, + "maxduration": 150 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "video": { + "mimes": [ + "video\/mp4" + ], + "minduration": 120, + "maxduration": 150, + "w": 640, + "h": 480 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720, + "ext": { + "adagio": { + "outstream": { + "bvwUrl": "https://cool.io" + } + }, + "prebid": { + "type": "video" + } + } + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adagio": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [ + { + "bid": { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 1280, + "h": 720, + "ext": { + "adagio": { + "outstream": { + "bvwUrl": "https://cool.io" + } + }, + "prebid": { + "type": "video" + } + } + }, + "type":"video" + } + ] + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/adagiotest/params/race/banner.json b/adapters/adagio/adagiotest/params/race/banner.json new file mode 100644 index 00000000000..66694466d84 --- /dev/null +++ b/adapters/adagio/adagiotest/params/race/banner.json @@ -0,0 +1,5 @@ +{ + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" +} diff --git a/adapters/adagio/adagiotest/params/race/native.json b/adapters/adagio/adagiotest/params/race/native.json new file mode 100644 index 00000000000..4affd5b232c --- /dev/null +++ b/adapters/adagio/adagiotest/params/race/native.json @@ -0,0 +1,5 @@ +{ + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" +} diff --git a/adapters/adagio/adagiotest/params/race/video.json b/adapters/adagio/adagiotest/params/race/video.json new file mode 100644 index 00000000000..4affd5b232c --- /dev/null +++ b/adapters/adagio/adagiotest/params/race/video.json @@ -0,0 +1,5 @@ +{ + "organizationId": "1000", + "site": "site-name", + "placement": "in_article" +} diff --git a/adapters/adagio/adagiotest/supplemental/response-miss-ext-bid-type.json b/adapters/adagio/adagiotest/supplemental/response-miss-ext-bid-type.json new file mode 100644 index 00000000000..7b1267f6d50 --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/response-miss-ext-bid-type.json @@ -0,0 +1,130 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "tmax": 1000, + "user": { + "buyeruid": "awesome-user" + }, + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ], + "X-Forwarded-For": [ + "123.123.123.123" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "device": { + "ua": "test-user-agent", + "ip": "123.123.123.123", + "language": "en", + "dnt": 0 + }, + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ], + "site": { + "page": "test.com", + "publisher": { + "id": "123456789" + } + }, + "user": { + "buyeruid": "awesome-user" + }, + "tmax": 1000 + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "awesome-resp-id", + "seatbid": [ + { + "bid": [ + { + "id": "a3ae1b4e2fc24a4fb45540082e98e161", + "impid": "some-impression-id", + "price": 3.5, + "adm": "awesome-markup", + "adomain": [ + "awesome.com" + ], + "crid": "20", + "w": 320, + "h": 50, + "ext": {} + } + ], + "seat": "adagio" + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "adagio": 154 + }, + "tmaxrequest": 1000 + } + } + } + } + ], + "expectedBidResponses": [ + { + "bids": [] + } + ] +} diff --git a/adapters/adagio/adagiotest/supplemental/status-204.json b/adapters/adagio/adagiotest/supplemental/status-204.json new file mode 100644 index 00000000000..4d604a01fb9 --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-204.json @@ -0,0 +1,62 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ], + "expectedBidResponses": [] +} diff --git a/adapters/adagio/adagiotest/supplemental/status-400.json b/adapters/adagio/adagiotest/supplemental/status-400.json new file mode 100644 index 00000000000..093c5458c0a --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-400.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 400, + "body": "bad request" + } + } + ], + "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/adagio/adagiotest/supplemental/status-401.json b/adapters/adagio/adagiotest/supplemental/status-401.json new file mode 100644 index 00000000000..a33aca203d0 --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-401.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 401, + "body": "unauthorized" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 401. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/adagiotest/supplemental/status-403.json b/adapters/adagio/adagiotest/supplemental/status-403.json new file mode 100644 index 00000000000..59c5a9cbf6b --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-403.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 403, + "body": "forbidden" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 403. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/adagiotest/supplemental/status-500.json b/adapters/adagio/adagiotest/supplemental/status-500.json new file mode 100644 index 00000000000..0077d7457f9 --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-500.json @@ -0,0 +1,68 @@ +{ + "mockBidRequest": { + "test": 1, + "debug": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 500, + "body": "internal error" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 500. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/adagiotest/supplemental/status-503.json b/adapters/adagio/adagiotest/supplemental/status-503.json new file mode 100644 index 00000000000..d2a52893de5 --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-503.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 503, + "body": "Service unavailable" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 503. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/adagio/adagiotest/supplemental/status-504.json b/adapters/adagio/adagiotest/supplemental/status-504.json new file mode 100644 index 00000000000..1b779d5c83f --- /dev/null +++ b/adapters/adagio/adagiotest/supplemental/status-504.json @@ -0,0 +1,67 @@ +{ + "mockBidRequest": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Accept": [ + "application/json" + ] + }, + "uri": "http://localhost/prebid_server", + "body": { + "test": 1, + "id": "some-request-id", + "imp": [ + { + "id": "some-impression-id", + "banner": { + "w": 320, + "h": 50 + }, + "ext": { + "bidder": { + "organizationId": "1000", + "site": "site-name", + "placement": "ban_atf" + } + } + } + ] + } + }, + "mockResponse": { + "status": 504, + "body": "gateway timeout" + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 504. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} \ No newline at end of file diff --git a/adapters/adagio/params_test.go b/adapters/adagio/params_test.go new file mode 100644 index 00000000000..ee8f702e451 --- /dev/null +++ b/adapters/adagio/params_test.go @@ -0,0 +1,57 @@ +package adagio + +import ( + "encoding/json" + "testing" + + "github.com/prebid/prebid-server/openrtb_ext" +) + +var validParams = []string{ + `{ "organizationId": "1234", "site": "adagio-io", "placement": "ban_atf" }`, + `{ "organizationId": "1234", "site": "adagio-io", "placement": "ban_atf", "_unknown": "ban_atf"}`, + `{ "organizationId": "1234", "site": "adagio-io", "placement": "ban_atf", "features": {"a": "a", "b": "b"}}`, +} + +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.BidderAdagio, json.RawMessage(validParam)); err != nil { + t.Errorf("Schema rejected Adagio params: %s", validParam) + } + } +} + +var invalidParams = []string{ + ``, + `null`, + `true`, + `5`, + `4.2`, + `[]`, + `{}`, + `{"adCode": "string", "seatCode": 5, "originalPublisherid": "string"}`, + `{ "organizationId": "", "site": "", "placement": "" }`, + `{ "organizationId": "", "site": "2", "placement": "3" }`, + `{ "organizationId": "1", "site": "", "placement": "3" }`, + `{ "organizationId": "1", "site": "2", "placement": "" }`, + `{ "organizationId": 1, "site": "2", "placement": "3" }`, + `{ "organizationId": "1234", "site": "adagio-io", "placement": "ban_atf", "features": {"a": "a", "notastring": true}}`, +} + +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.BidderAdagio, json.RawMessage(invalidParam)); err == nil { + t.Errorf("Schema allowed unexpected params: %s", invalidParam) + } + } +} diff --git a/adapters/adagio/usersync.go b/adapters/adagio/usersync.go new file mode 100644 index 00000000000..a7230feaada --- /dev/null +++ b/adapters/adagio/usersync.go @@ -0,0 +1,12 @@ +package adagio + +import ( + "text/template" + + "github.com/prebid/prebid-server/adapters" + "github.com/prebid/prebid-server/usersync" +) + +func NewAdagioSyncer(tmpl *template.Template) usersync.Usersyncer { + return adapters.NewSyncer("adagio", tmpl, adapters.SyncTypeRedirect) +} diff --git a/adapters/adagio/usersync_test.go b/adapters/adagio/usersync_test.go new file mode 100644 index 00000000000..cd4195e16df --- /dev/null +++ b/adapters/adagio/usersync_test.go @@ -0,0 +1,34 @@ +package adagio + +import ( + "testing" + "text/template" + + "github.com/prebid/prebid-server/privacy" + "github.com/prebid/prebid-server/privacy/ccpa" + "github.com/prebid/prebid-server/privacy/gdpr" + "github.com/stretchr/testify/assert" +) + +func TestAdagioSyncer(t *testing.T) { + syncURL := "https://mp.4dex.io/sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dadagio%26uid%3D%5BUID%5D" + syncURLTemplate := template.Must( + template.New("sync-template").Parse(syncURL), + ) + + syncer := NewAdagioSyncer(syncURLTemplate) + syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{ + GDPR: gdpr.Policy{ + Signal: "0", + Consent: "ANDFJDS", + }, + CCPA: ccpa.Policy{ + Consent: "1-YY", + }, + }) + + assert.NoError(t, err) + assert.Equal(t, "https://mp.4dex.io/sync?gdpr=0&gdpr_consent=ANDFJDS&us_privacy=1-YY&redirect=http%3A%2F%2Flocalhost%3A8000%2Fsetuid%3Fbidder%3Dadagio%26uid%3D%5BUID%5D", syncInfo.URL) + assert.Equal(t, "redirect", syncInfo.Type) + assert.Equal(t, false, syncInfo.SupportCORS) +} diff --git a/config/config.go b/config/config.go index b8ff3bd6116..6e8b661a13b 100644 --- a/config/config.go +++ b/config/config.go @@ -602,6 +602,7 @@ func (cfg *Configuration) setDerivedDefaults() { externalURL := cfg.ExternalURL setDefaultUsersync(cfg.Adapters, openrtb_ext.Bidder33Across, "https://ic.tynt.com/r/d?m=xch&rt=html&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&ru="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3D33across%26uid%3D33XUSERID33X&id=zzz000000000002zzz") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAcuityAds, "https://cs.admanmedia.com/sync/prebid?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dacuityads%26uid%3D%5BUID%5D") + setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdagio, "https://mp.4dex.io/sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadagio%26uid%3D%7B%7BUID%7D%7D%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26us_privacy%3D{{.USPrivacy}}") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdf, "https://cm.adform.net/cookie?redirect_url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadf%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderAdform, "https://cm.adform.net/cookie?redirect_url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dadform%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID") // openrtb_ext.BidderAdgeneration doesn't have a good default. @@ -849,6 +850,7 @@ func SetupViper(v *viper.Viper, filename string) { v.SetDefault("adapters.33across.endpoint", "https://ssc.33across.com/api/v1/s2s") v.SetDefault("adapters.33across.partner_id", "") v.SetDefault("adapters.acuityads.endpoint", "http://{{.Host}}.admanmedia.com/bid?token={{.AccountID}}") + v.SetDefault("adapters.adagio.endpoint", "https://mp.4dex.io/ortb2") v.SetDefault("adapters.adf.endpoint", "https://adx.adform.net/adx/openrtb") v.SetDefault("adapters.adform.endpoint", "https://adx.adform.net/adx") v.SetDefault("adapters.adgeneration.endpoint", "https://d.socdm.com/adsv/v1") diff --git a/exchange/adapter_builders.go b/exchange/adapter_builders.go index 1d91fadd96d..e1dbc3509b2 100755 --- a/exchange/adapter_builders.go +++ b/exchange/adapter_builders.go @@ -4,6 +4,7 @@ import ( "github.com/prebid/prebid-server/adapters" ttx "github.com/prebid/prebid-server/adapters/33across" "github.com/prebid/prebid-server/adapters/acuityads" + "github.com/prebid/prebid-server/adapters/adagio" "github.com/prebid/prebid-server/adapters/adf" "github.com/prebid/prebid-server/adapters/adform" "github.com/prebid/prebid-server/adapters/adgeneration" @@ -129,6 +130,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder { return map[openrtb_ext.BidderName]adapters.Builder{ openrtb_ext.Bidder33Across: ttx.Builder, openrtb_ext.BidderAcuityAds: acuityads.Builder, + openrtb_ext.BidderAdagio: adagio.Builder, openrtb_ext.BidderAdf: adf.Builder, openrtb_ext.BidderAdform: adform.Builder, openrtb_ext.BidderAdgeneration: adgeneration.Builder, diff --git a/openrtb_ext/bidders.go b/openrtb_ext/bidders.go index 8a589bd1a74..2a08fd19eb2 100644 --- a/openrtb_ext/bidders.go +++ b/openrtb_ext/bidders.go @@ -75,6 +75,7 @@ func IsBidderNameReserved(name string) bool { const ( Bidder33Across BidderName = "33across" BidderAcuityAds BidderName = "acuityads" + BidderAdagio BidderName = "adagio" BidderAdf BidderName = "adf" BidderAdform BidderName = "adform" BidderAdgeneration BidderName = "adgeneration" @@ -200,6 +201,7 @@ func CoreBidderNames() []BidderName { return []BidderName{ Bidder33Across, BidderAcuityAds, + BidderAdagio, BidderAdf, BidderAdform, BidderAdgeneration, diff --git a/static/bidder-info/adagio.yaml b/static/bidder-info/adagio.yaml new file mode 100644 index 00000000000..3661191b3a1 --- /dev/null +++ b/static/bidder-info/adagio.yaml @@ -0,0 +1,12 @@ +maintainer: + email: "dev@adagio.io" +gvlVendorID: 617 +modifyingVastXmlAllowed: false +debug: + allow: true +capabilities: + site: + mediaTypes: + - banner + - video + - native \ No newline at end of file diff --git a/static/bidder-params/adagio.json b/static/bidder-params/adagio.json new file mode 100644 index 00000000000..955c58c73ec --- /dev/null +++ b/static/bidder-params/adagio.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Adagio Adapter Params", + "description": "A schema which validates params accepted by the Adagio adapter", + "type": "object", + "required": [ + "organizationId", + "site", + "placement" + ], + "properties": { + "organizationId": { + "type": "string", + "description": "Name to identify the organization", + "minLength": 1 + }, + "site": { + "type": "string", + "description": "Name to identify the site", + "minLength": 1 + }, + "placement": { + "type": "string", + "description": "Name to identify the placement", + "minLength": 1 + }, + "pageviewId": { + "type": "string", + "description": "Name to identify the pageview" + }, + "pagetype": { + "type": "string", + "description": "Name to identify the page type" + }, + "category": { + "type": "string", + "description": "Name to identify the category" + }, + "subcategory": { + "type": "string", + "description": "Name to identify the subcategory" + }, + "environment": { + "type": "string", + "description": "Name to identify the environment" + }, + "features": { + "type": "object", + "patternProperties": { + "^[a-zA-Z_]": { "type": "string" } + } + }, + "prebidVersion:": { + "type": "string", + "description": "Name to identify the version of Prebid.js" + }, + "debug": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "cpm": { + "type": "number" + }, + "lazyLoad": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "threshold": { + "type": "number" + }, + "rootMargin": { + "type": "string" + } + } + } + } + }, + "native": { + "type": "object", + "properties": { + "context": { + "type": "number" + }, + "plcmttype": { + "type": "number" + } + } + } + } +} diff --git a/usersync/usersyncers/syncer.go b/usersync/usersyncers/syncer.go index 674fc136527..8275869f5b2 100644 --- a/usersync/usersyncers/syncer.go +++ b/usersync/usersyncers/syncer.go @@ -8,6 +8,7 @@ import ( "github.com/golang/glog" ttx "github.com/prebid/prebid-server/adapters/33across" "github.com/prebid/prebid-server/adapters/acuityads" + "github.com/prebid/prebid-server/adapters/adagio" "github.com/prebid/prebid-server/adapters/adf" "github.com/prebid/prebid-server/adapters/adform" "github.com/prebid/prebid-server/adapters/adkernel" @@ -111,6 +112,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync insertIntoMap(cfg, syncers, openrtb_ext.Bidder33Across, ttx.New33AcrossSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAcuityAds, acuityads.NewAcuityAdsSyncer) + insertIntoMap(cfg, syncers, openrtb_ext.BidderAdagio, adagio.NewAdagioSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdf, adf.NewAdfSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdform, adform.NewAdformSyncer) insertIntoMap(cfg, syncers, openrtb_ext.BidderAdkernel, adkernel.NewAdkernelSyncer) diff --git a/usersync/usersyncers/syncer_test.go b/usersync/usersyncers/syncer_test.go index 8a2a3e5d2e1..342d2ae81b9 100644 --- a/usersync/usersyncers/syncer_test.go +++ b/usersync/usersyncers/syncer_test.go @@ -16,6 +16,7 @@ func TestNewSyncerMap(t *testing.T) { Adapters: map[string]config.Adapter{ string(openrtb_ext.Bidder33Across): syncConfig, string(openrtb_ext.BidderAcuityAds): syncConfig, + string(openrtb_ext.BidderAdagio): syncConfig, string(openrtb_ext.BidderAdf): syncConfig, string(openrtb_ext.BidderAdform): syncConfig, string(openrtb_ext.BidderAdkernel): syncConfig,