prebid-server icon indicating copy to clipboard operation
prebid-server copied to clipboard

Support the delivery of custom bid data to prebid.js

Open philipwatson opened this issue 3 months ago • 5 comments

Looking for a way to deliver custom bid data from the server-side bidder adapter to prebid.js for the publisher to use. There doesn't appear to be one?

It appears that bid.meta can be a solution for this because prebid.js' pbs adapter takes the meta as-is. However, the meta in both pbs codebases (Java & Go) is not a type that provides the flexibility of adding custom fields (the ExtBidPrebidMeta class/struct).

Related issue here: https://github.com/prebid/prebid-server/issues/1922 Note the Go and Java implementations linked to this issue are different:

  • The Java change allowed for custom fields. On ExtBidPrebid, it changed the meta's type to ObjectNode from ExtBidPrebidMeta. It was later reverted (accidentally?) in a future PR: https://github.com/prebid/prebid-server-java/pull/2707
  • The Go change allowed the ExtBidPrebidMeta to come from bid.ext.prebid.meta. But no custom field support.

philipwatson avatar Sep 29 '25 22:09 philipwatson

Hi @philipwatson, can you share your use case? How are you going to use this custom data on the client? Currently when PBJS is connecting with PBS to retrieve bids, it isn't going to perform any processing on the bid response ext.

bsardo avatar Oct 03 '25 14:10 bsardo

Hi @bsardo

We offer an alternative script (a publisher API) which uses Prebid.js. It provides additional functionality such as direct rendering (bypass GAM based on prediction outcome), high-impact formats (multi-placement ads), sponsorship ads, etc. This API is mainly used by Ströer owned and operated publishers.

For this stuff to work, we need to add additional data on our bids for our bidsBackHandler. This is where the processing of the bid response ext is done (not in the core of Prebid.js).

Unfortunately, this can only work when using the client-side bidder adapter.

We also have independent publishers (not using our script/API) who wish to tap into our high-value demand and are willing to implement support - at least on the browser side - with our help. Unfortunately, we can’t help them when they want to use our server-side bidder adapter. This is where the pressure is at the moment; so I'm currently exploring options. Options found so far:

  • use custom targeting. Publisher will need to set stored request id on ortb2; or directly add the adservertargeting on ortb2 for this to work. Then the bidsBackHandler can access the data on the bid's adserverTargeting field.
  • use bid's meta.rendererData at least for the rendering-related cases (even though is designed for Mobile SDK, still flows all the way to the bidsBackHandler in a PBS+Prebid.js setup)

Not sure about the options, they feel like workarounds.

philipwatson avatar Oct 06 '25 02:10 philipwatson

@philipwatson discussed in the PMC. We are ok with this. Would you like to propose a field on bid.ext that will capture the data you are looking to pass through?

bsardo avatar Oct 22 '25 14:10 bsardo

@bsardo This is great news, thank you!

Not too fussed about the field name - happy to go with whatever everyone agrees on. Some ideas from me is: bidder, bidderData and bidderExt.

philipwatson avatar Oct 24 '25 01:10 philipwatson

Just for reference, after investigating it looks like the following is where the logic for all this lives in PrebidJS, Java and Go:

  • PrebidJS merges the meta fields in, preserving anything you want to add: https://github.com/prebid/Prebid.js/blob/3708e5ff00d111c5f5011ea3470d5c8d057cb179/libraries/pbsExtensions/processors/pbs.js#L72
  • Go has a strict struct that unmarshalles only “valid” fields, silently dropping anything that is not part of the struct here: https://github.com/prebid/prebid-server/blob/21e0f06a3ffac317cd710c23a3b7742cb1939c8c/exchange/exchange.go#L1395
  • For Java, it looks we went from the more permissive ObjectNode to the more restrictive ExtBidPrebidMeta (similar to Go) here: https://github.com/prebid/prebid-server-java/pull/2707/files

As for fixes, for Go, it would mean adding a less strictly typed field that passes through the custom fields. And for Java it would be something similar (probably in that build function for the ExtBidPrebidMeta class).

In either case, I think we can make those changes and then add a new field like customBidderData for holding that information.

jcerone avatar Oct 31 '25 15:10 jcerone