Skip to content

Conversation

@piotrj-rtbh
Copy link
Contributor

@piotrj-rtbh piotrj-rtbh commented Oct 8, 2025

🔧 Type of changes

  • bid adapter update
  • enhancement

✨ What's the context?

Related PR (Golang): prebid/prebid-server#4564
These changes address specific RTBHouse bidder requirements:

  1. PMP Removal: RTBHouse bidder doesn't support private marketplace deals for Prebid Server and requires clean bid requests without PMP data
  2. Publisher ID: Enables proper publisher identification in RTBHouse's system for better targeting and reporting

📋 Description

This PR implements two key enhancements to the RTBHouse bidder adapter:

  1. PMP Deals Removal: Automatically removes the imp[].pmp object from all impressions in outgoing bid requests to RTBHouse
  2. Publisher ID Extraction: Extracts publisher ID from impression extensions and propagates it to site.publisher.ext.prebid.publisherId in the bid request

🧪 Testing results

Tests run: 22, Failures: 0, Errors: 0, Skipped: 0
All RTBHouse bidder tests pass successfully, including:

  • Unit tests for new functionality (10 tests)
  • Integration test with updated mock expectations (1 test)
  • Backward compatibility verification

Other information

Please reach us at inventory_support@rtbhouse.com with piotr.jaworski@rtbhouse.com and cc leandro.otani@rtbhouse.com.

Comment on lines 236 to 256
static BidRequest updateSitePublisherId(BidRequest bidRequest, String publisherId) {
if (bidRequest == null || publisherId == null) {
return bidRequest;
}

final Site site = bidRequest.getSite();
Publisher publisher = (site != null) ? site.getPublisher() : null;

final PublisherBuilder publisherBuilder = (publisher != null)
? publisher.toBuilder()
: Publisher.builder();

publisherBuilder.id(publisherId);
publisher = publisherBuilder.build();

final Site updatedSite = (site != null)
? site.toBuilder().publisher(publisher).build()
: Site.builder().publisher(publisher).build();

return bidRequest.toBuilder().site(updatedSite).build();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

    private Site modifySite(Site site, String siteId) {
        final Publisher publisher = Optional.ofNullable(site)
                .map(Site::getPublisher)
                .map(Publisher::toBuilder)
                .orElseGet(Publisher::builder)
                .ext(ExtPublisher.of(ExtPublisherPrebid.of(siteId)))
                .build();

        return Optional.ofNullable(site)
                .map(Site::toBuilder)
                .orElseGet(Site::builder)
                .publisher(publisher)
                .build();
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can dig into the code, .ext(ExtPublisher.of(ExtPublisherPrebid.of(siteId))) suggests that siteId will be assigned to some other place within request.site.publisher.ext.prebid...., which is not exactly what we wanted to achieve. After some deeper analysis we decided to not overwrite request.site.publisher.id but instead copy it to some other place suggested by your code, so we decided to pick request.site.publisher.ext.prebid.publisherId. How should we proceed with this change?

Copy link
Collaborator

Choose a reason for hiding this comment

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

My bad, I gave you an incorrect refactoring example for your case.
It should have been something like the following and it would be totally fine (I can spot a lot of other bidders that do similar things you try to do)

    private static Site modifySite(Site site, String id) {
        return Optional.ofNullable(site)
                .map(Site::toBuilder)
                .map(builder -> builder.publisher(modifyPublisher(site.getPublisher(), id)))
                .map(Site.SiteBuilder::build)
                .orElse(null);
    }
    
   private static Publisher modifyPublisher(Publisher publisher, String id) {
        return Optional.ofNullable(publisher)
                .map(Publisher::toBuilder)
                .orElseGet(Publisher::builder)
                .id(id)
                .build();
   }            

But If you'd like to set the siteId to another target request.site.publisher.ext.prebid.publisherId I can suggest adding a publisherId property to the ExtPublisherPrebid class - but you have to make sure other bidders that uses the same class will be able to compile and the tests will pass after the changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the explanations. Initially, I considered modifying ExtPublisherPrebid, but since it might be used elsewhere, I chose a different approach - see my recent updates to modifySite(). Does this look okay to you?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you don't need request.site.publisher.ext.prebid.parentAccount field your approach is fine, otherwise your code removes the parentAccount field from the request.site.publisher.ext.prebid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't need this field. Thank you for clarification.

Copy link
Contributor Author

@piotrj-rtbh piotrj-rtbh left a comment

Choose a reason for hiding this comment

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

@CTMBNara All issues have been addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants