PubMatic: Pass alias bidder name through by Pubmatic-Supriya-Patil · Pull Request #4588 · prebid/prebid-server · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions adapters/pubmatic/pubmatic.go
9 changes: 9 additions & 0 deletions exchange/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,15 @@ func buildRequestExtForBidder(bidder string, req *openrtb_ext.RequestWrapper, re
AlternateBidderCodes: alternateBidderCodes,
}

if prebid := reqExt.GetPrebid(); prebid != nil && prebid.Aliases != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can directly use prebid as prebid is already populated on line no 499:

if prebid != nil && prebid.Aliases != nil {

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.

Removed extra check for prebid

if aliasValue, ok := prebid.Aliases[bidder]; ok {
if prebidNew.Aliases == nil {
prebidNew.Aliases = make(map[string]string)
}
prebidNew.Aliases[bidder] = aliasValue
}
}

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.

You should be able to simplify this to:

if prebid != nil && prebid.Aliases != nil {
	if aliasValue, ok := prebid.Aliases[bidder]; ok {
		prebidNew.Aliases = map[string]string{
			bidder: aliasValue,
		}
	}
}

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

@bsardo bsardo Oct 31, 2025

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.

👍 IMO this is the right place for this logic. This function is called once per bidder and you're scrubbing ext.prebid.aliases so it only contains at most a single entry which would be the alias to adapter entry that applies to this bidder.


// Copy Allowed Fields
// Per: https://docs.prebid.org/prebid-server/endpoints/openrtb2/pbs-endpoint-auction.html#prebid-server-ortb2-extension-summary
if prebid != nil {
Expand Down
Loading