Skip to content

New Adapter: Start.io#4324

Merged
bsardo merged 4 commits into
prebid:masterfrom
startappdev:implement-start-io-adapter
Jun 5, 2025
Merged

New Adapter: Start.io#4324
bsardo merged 4 commits into
prebid:masterfrom
startappdev:implement-start-io-adapter

Conversation

@prebid-startio
Copy link
Copy Markdown
Contributor

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

Comment thread adapters/startio/startio.go Outdated
var bidExt openrtb_ext.ExtBid
err := jsonutil.Unmarshal(bid.Ext, &bidExt)
if err == nil && bidExt.Prebid != nil {
switch bidExt.Prebid.Type {
Copy link
Copy Markdown

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 {
Copy link
Copy Markdown

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 {
Copy link
Copy Markdown

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.

@github-actions
Copy link
Copy Markdown

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: prebid@start.io
gvlVendorID: 1216
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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: prebid@start.io
Copy link
Copy Markdown
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
Copy Markdown
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: prebid@start.io
gvlVendorID: 1216
Copy link
Copy Markdown
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"
}

Comment thread adapters/startio/startio.go Outdated
"github.com/prebid/prebid-server/v3/util/jsonutil"
)

type StartioAdapter struct {
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment thread adapters/startio/startio.go Outdated
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
Copy Markdown
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, done.

Comment thread adapters/startio/startio.go Outdated
}

var errs []error
bidderResponse := adapters.NewBidderResponseWithBidsCapacity(len(bidResponse.SeatBid))
Copy link
Copy Markdown
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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, adjusted.

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
Copy Markdown
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment thread adapters/startio/startio.go Outdated
}

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

Copy link
Copy Markdown
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.


func validateRequest(request openrtb2.BidRequest) error {
if !isSupportedCurrency(request.Cur) {
return wrapReqError("unsupported currency: only USD is accepted")
Copy link
Copy Markdown
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment thread adapters/startio/startio.go Outdated
}

if !hasSiteOrAppID(request) {
return wrapReqError("request must contain either site.id or app.id")
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hasSiteOrAppID has been removed. Please, correct me if I am wrong, but these tests are not needed anymore.

@github-actions
Copy link
Copy Markdown

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%

@github-actions
Copy link
Copy Markdown

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, 87061fe

startio

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/startio/startio.go:20:	Builder			100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:28:	MakeRequests		86.7%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:62:	MakeBids		100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:98:	validateRequest		100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:106:	buildRequestHeaders	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:115:	isSupportedCurrency	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:119:	getMediaTypeForBid	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:140:	wrapReqError		100.0%
total:									(statements)		96.2%

@przemkaczmarek
Copy link
Copy Markdown
Collaborator

przemkaczmarek commented May 27, 2025

LGTM now.
I would add only

if len(bidResponse.SeatBid) == 0 || len(bidResponse.SeatBid[0].Bid) == 0 {
    return nil, nil
} 

in MakeBids func.

@github-actions
Copy link
Copy Markdown

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, c40280b

startio

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/startio/startio.go:20:	Builder			100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:28:	MakeRequests		86.7%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:62:	MakeBids		94.7%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:102:	validateRequest		100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:110:	buildRequestHeaders	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:119:	isSupportedCurrency	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:123:	getMediaTypeForBid	100.0%
github.com/prebid/prebid-server/v3/adapters/startio/startio.go:144:	wrapReqError		100.0%
total:									(statements)		94.5%

@prebid-startio
Copy link
Copy Markdown
Contributor Author

LGTM now. I would add only

if len(bidResponse.SeatBid) == 0 || len(bidResponse.SeatBid[0].Bid) == 0 {
    return nil, nil
} 

in MakeBids func.

Thanks. Added requested conditional checks.

@bsardo
Copy link
Copy Markdown
Collaborator

bsardo commented Jun 5, 2025

LGTM now. I would add only

if len(bidResponse.SeatBid) == 0 || len(bidResponse.SeatBid[0].Bid) == 0 {
    return nil, nil
} 

in MakeBids func.

@przemkaczmarek just FYI, we shouldn't need to add these checks. PBS core will handle these cases appropriately keeping the bidder out of the final bid response sent back to the publisher.

@bsardo bsardo merged commit e77f0dc into prebid:master Jun 5, 2025
6 checks passed
shunj-nb pushed a commit to ParticleMedia/prebid-server that referenced this pull request Jun 13, 2025
prnvgupta pushed a commit to automatad/prebid-server that referenced this pull request Dec 3, 2025
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