Skip to content
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

Update floors module to work with ortb2Imp.bidfloor #11285

Open
wiedaw opened this issue Apr 3, 2024 · 9 comments
Open

Update floors module to work with ortb2Imp.bidfloor #11285

wiedaw opened this issue Apr 3, 2024 · 9 comments
Assignees

Comments

@wiedaw
Copy link

wiedaw commented Apr 3, 2024

Type of issue

Question

Description

I have the script which calls requestBids. The script doesn’t use addAdunit method to define the adUnit but calls directly requestBids with the adUnit as an argument. Ad units have set floor.

I'm wondering if there is possibility to change the floor configuration from external script just before sending bid request. I was checking beforeRequestBids, auctionInit events but it doesn't work and the floor stays the same, do not take into consideration my changes in configuration.

Expected results

Expected result is to be able to set floors from external script.

Actual results

Platform details

Prebid.js version 8.27.0

@dgirardi
Copy link
Collaborator

dgirardi commented Apr 3, 2024

As you have discovered, floor data is calculated before the first auction event fires. There's a few ways you could work around it but none are clean. I think we could delay floor logic until after BEFORE_REQUEST_BIDS to address this.

Currently, ad units have one piece of floor information that you can manipulate, ortb2Imp.ext.prebid.floors.floorMin. If that's higher than the floor, it will override it. This would only work if the adUnit always sets a single, lower floor.

Otherwise I think the next best - but still very ugly - way to do this would be to monkey-patch requestBids.

@wiedaw
Copy link
Author

wiedaw commented Apr 5, 2024

@dgirardi thank you for the answer. Both solutions work for me.

@dgirardi dgirardi self-assigned this Apr 8, 2024
@dgirardi
Copy link
Collaborator

dgirardi commented Apr 8, 2024

Proposal:

  • publishers can set per-adunit static floors with ortb2Imp: {bidfloor, bidfloorcur}
  • core provides a default bidRequest.getFloor() method that returns the floor defined as above, if any. This would allow current adapter implementations to pick up static floors even without the floors module.
  • if the adUnit does not have ortb2Imp.bidfloor set, the floors module should run its improved getFloors() on each bid request, and populate its ortb2Imp.bidfloor.
  • adapters that currently get a single floor by calling getFloor() with no qualifiers can then pick it up directly from bidRequest.ortb2Imp.bidfloor.

@dgirardi dgirardi changed the title Setting price floor just before sending the bid request Update priceFloors to work with ortb2Imp.bidfloor Apr 8, 2024
@dgirardi dgirardi changed the title Update priceFloors to work with ortb2Imp.bidfloor Update floors module to work with ortb2Imp.bidfloor Apr 8, 2024
@bretg
Copy link
Collaborator

bretg commented Apr 8, 2024

Thanks @dgirardi - I agree with 3 of these bullet points. But not this one:

if the adUnit does not have ortb2Imp.bidfloor set, the floors module should run its improved getFloors() on each bid request, and populate its ortb2Imp.bidfloor.

If the floors module is active, it's floors should override static default AdUnit.ortb2Imp.bidfloor values. Yes, I recognize this is the opposite of the standard that publisher-supplied values take precedence, but given the nature of this feature, I think it's warranted. A publisher that wants to supply a completely static floor value should just not incorporate the floors module.

@patmmccann
Copy link
Collaborator

We rely on before request bids to ascertain the floor we've set

@lcorrigall
Copy link

Current behaviour in the ortb2Converter is that it will use the floor from the Floors Module if a floor is also specified on ortb2Imp.bidfloor.

PMC decision: We don't want to introduce a breaking change. The ortb2Imp.bidfloor should only be used if publishers do not want to use the Floors module. If the Floors module is present, Prebid.js will always use those floors.

There is an implied feature request here to make it easier update the floors manually in the Floors module.

@muuki88
Copy link
Collaborator

muuki88 commented Apr 10, 2024

Hi @wiedaw

You are basically set up for dynamic floors from any source you want. If you build the adUnits dynamically, you can add the floors you want there.

It's defined here in great detail: https://docs.prebid.org/dev-docs/modules/floors.html#defining-floors#floors-defined-in-the-adunit

In the end you set a floors property on the ad unit with whatever you want

 var adUnits = [
         {
             code: 'test-div',
             mediaTypes: {
                 banner: { sizes: [[300,250],[300,600]] }
             },
             // get this project from where ever you like it to be 
             floors: {
                 currency: 'USD',
                 schema: {
                     delimiter: '|',
                     fields: [ 'mediaType' ]
                 },
                 values: {
                     '*': 1.10 /* here you can calculate whatever you want */
                 }
             },
             bids: [
                 // ...
             ]
         }
     ];

@wiedaw
Copy link
Author

wiedaw commented Apr 11, 2024

@muuki88 yes, indeed but the situation I described was different. The are no adUnits defined at the beginning but all adUnits with their floors are added directly to requestBids method as arguments. So my question was how from external script could I change floors for these adUnits. I got the answer about floorMin and monkey-patch which works fine for me. If you know any other way to achive it please describe.

@muuki88
Copy link
Collaborator

muuki88 commented Apr 11, 2024

Hi @wiedaw

So I see three different scenarios here

  1. You have an external floor price provider that doesn't support the floorsModule
  2. You are an external floor price provider, but can't for some reasons build a floorPrice provider
  3. You are a publisher and want to set floor prices without implementing a floorsModule

1) External floor price provider

They should join this issue and explain a little bit their use case, why a floorPrice provider is not an option.

2) You are a floor price provider

I would assume that you want publishers to drop your script on the page and everything works magically. That's never going to work properly, because

  • what if the prebid auctions runs before you script loads
  • what if your script takes to long to load floors

I'm wondering if there is possibility to change the floor configuration from external script just before sending bid request. I was checking beforeRequestBids, auctionInit events but it doesn't work and the floor stays the same, do not take into consideration my changes in configuration.

What exactly have you tried?

3) You are a publisher

So you control the external script to some degree.

A very

window.pbjs = window.pbjs || { que: [] };
const pbjsReady = new Promise(resolve => window.pbjs.que.push(resolve));

const floors = new Promise(resolve => {
   // wait for the external script to push to a que like pbjs or dynamically insert the js here and wait for the onload event
  // and resolve the promise with the floor data
  resolve(floorData);
});

floors.then(floorData => {
  window.pbjs.que.push(() => {
    window.pbjs.requestBids({
       bidsBackHandler,
       adUnits: [
         {
             code: 'test-div',
             mediaTypes: {
                 banner: { sizes: [[300,250],[300,600]] }
             },
             // get this project from where ever you like it to be 
             floors: {
                 currency: 'USD',
                 schema: {
                     delimiter: '|',
                     fields: [ 'mediaType' ]
                 },
                 values: {
                     '*': floorData['test-div'];
                 }
             },
             bids: [
                 // ...
             ]
         }
     ];
       ]
    });
  });
});

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

No branches or pull requests

6 participants