Skip to content

New Adapter: Start.io #4324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

prebid-startio
Copy link

@prebid-startio prebid-startio commented Apr 29, 2025

var bidExt openrtb_ext.ExtBid
err := jsonutil.Unmarshal(bid.Ext, &bidExt)
if err == nil && bidExt.Prebid != nil {
switch bidExt.Prebid.Type {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeBanner. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

var bidExt openrtb_ext.ExtBid
err := jsonutil.Unmarshal(bid.Ext, &bidExt)
if err == nil && bidExt.Prebid != nil {
switch bidExt.Prebid.Type {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeNative. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

var bidExt openrtb_ext.ExtBid
err := jsonutil.Unmarshal(bid.Ext, &bidExt)
if err == nil && bidExt.Prebid != nil {
switch bidExt.Prebid.Type {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeVideo. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 5a30170

startio

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/startio/startio.go:21:	Builder			100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:34:	MakeRequests		88.2%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:70:	MakeBids		94.7%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:108:	validateRequest		100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:120:	getValidImpressions	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:138:	hasSiteOrAppID		100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:142:	buildRequestHeaders	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:151:	isSupportedCurrency	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:155:	getMediaTypeForBid	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:177:	wrapReqError		100.0%
total:									(statements)		95.8%

endpoint: "http://pbs-rtb.startappnetwork.com/1.3/2.5/getbid?account=pbs"
maintainer:
email: [email protected]
gvlVendorID: 1216
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
confirmed

Copy link
Collaborator

@bsardo bsardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@przemkaczmarek and I reviewed together. Please see comments.

@@ -0,0 +1,15 @@
endpoint: "http://pbs-rtb.startappnetwork.com/1.3/2.5/getbid?account=pbs"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified endpoint is reachable

curl -i --location --request POST http://pbs-rtb.startappnetwork.com/1.3/2.5/getbid?account=pbs
HTTP/1.1 200 OK
Date: Thu, 01 May 2025 13:31:53 GMT
Content-Length: 0
Connection: keep-alive
Server: Golang net/http

@@ -0,0 +1,15 @@
endpoint: "http://pbs-rtb.startappnetwork.com/1.3/2.5/getbid?account=pbs"
maintainer:
email: [email protected]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've sent an email to this address. Please reply with "confirmed" to verify that this address is reachable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed received response.

endpoint: "http://pbs-rtb.startappnetwork.com/1.3/2.5/getbid?account=pbs"
maintainer:
email: [email protected]
gvlVendorID: 1216
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified GVL is correct

curl https://vendor-list.consensu.org/v3/vendor-list.json | jq '.vendors."1216"'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  749k  100  749k    0     0  4788k      0 --:--:-- --:--:-- --:--:-- 4805k
{
  "id": 1216,
  "name": "Start.io Inc",
  "purposes": [
    1,
    3,
    4
  ],
  "legIntPurposes": [
    2,
    7,
    10
  ],
  "flexiblePurposes": [
    2,
    7,
    10
  ],
  "specialPurposes": [
    1,
    2
  ],
  "features": [
    1
  ],
  "specialFeatures": [
    1
  ],
  "overflow": {
    "httpGetLimit": 128
  },
  "cookieMaxAgeSeconds": null,
  "usesCookies": false,
  "cookieRefresh": false,
  "urls": [
    {
      "langId": "en",
      "privacy": "https://www.start.io/policy/privacy-policy-site/",
      "legIntClaim": "https://www.start.io/policy/privacy-policy-site/"
    },
    {
      "langId": "fr",
      "privacy": "https://www.start.io/policy/privacy-policy-site/",
      "legIntClaim": "https://www.start.io/policy/privacy-policy-site/"
    },
    {
      "langId": "es",
      "privacy": "https://www.start.io/policy/privacy-policy-site/",
      "legIntClaim": "https://www.start.io/policy/privacy-policy-site/"
    },
    {
      "langId": "de",
      "privacy": "https://www.start.io/policy/privacy-policy-site/",
      "legIntClaim": "https://www.start.io/policy/privacy-policy-site/"
    }
  ],
  "usesNonCookieAccess": true,
  "dataRetention": {
    "stdRetention": 365,
    "purposes": {},
    "specialPurposes": {}
  },
  "dataDeclaration": [
    1,
    2,
    3,
    6,
    7,
    8,
    9,
    10,
    11
  ],
  "deviceStorageDisclosureUrl": "https://info.startappservice.com/tcf/start.io_domains.json"
}

"github.com/prebid/prebid-server/v3/util/jsonutil"
)

type StartioAdapter struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: let's call this adapter

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 22 to 31
uri, err := url.ParseRequestURI(config.Endpoint)
if err != nil {
return nil, err
}

bidder := &StartioAdapter{
endpoint: uri.String(),
}

return bidder, nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're trying to validate your endpoint URL. This can be simplified to

bidder := &adapter{
    endpoint: config.Endpoint,
  }
  return bidder, nil

Endpoint validation occurs upstream when the YAML files are loaded.

}

var errs []error
bidderResponse := adapters.NewBidderResponseWithBidsCapacity(len(bidResponse.SeatBid))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to start with a capacity derived from SeatBid[i].Bid instead?

Comment on lines +172 to +174
return "", &errortypes.BadServerResponse{
Message: fmt.Sprintf("Failed to parse bid media type for impression %s.", bid.ImpID),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a supplemental JSON test called invalid-resp-media-type.json to cover this case. Since you don't support audio I suggest returning that in your response.

}

func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nitpick: delete blank line


func validateRequest(request openrtb2.BidRequest) error {
if !isSupportedCurrency(request.Cur) {
return wrapReqError("unsupported currency: only USD is accepted")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a supplemental JSON test called req-invalid-unsupported-cur.json to cover this case.

}

if !hasSiteOrAppID(request) {
return wrapReqError("request must contain either site.id or app.id")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add supplemental JSON tests called req-invalid-missing-site-id.json and req-invalid-missing-app-id.json to cover this case.

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 8b8e7bd

startio

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/startio/startio.go:21:	Builder			100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:34:	MakeRequests		88.2%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:70:	MakeBids		94.7%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:108:	validateRequest		100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:120:	getValidImpressions	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:138:	hasSiteOrAppID		100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:142:	buildRequestHeaders	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:151:	isSupportedCurrency	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:155:	getMediaTypeForBid	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:177:	wrapReqError		100.0%
total:									(statements)		95.8%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants