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

RAS Bid Adapter: fledge support #10477

Merged
merged 2 commits into from
Oct 3, 2023
Merged

Conversation

wsusrasp
Copy link
Contributor

Type of change

  • Bugfix

  • Feature

  • New bidder adapter

  • Code style update (formatting, local variables)

  • Refactoring (no functional changes, no api changes)

  • Build related changes

  • CI related changes

  • Does this change affect user-facing APIs or examples documented on http://prebid.org?

  • Other

Description of change

Add support for the fledge.

Other information

@@ -129,6 +129,36 @@ const getGdprParams = (bidderRequest) => {
return queryString;
};

const parseAuctionConfigs = (serverResponse, bidRequest) => {
if (isEmpty(serverResponse) || isEmpty(bidRequest)) {
return null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not append fledge if it is empty?

Copy link
Contributor Author

@wsusrasp wsusrasp Sep 14, 2023

Choose a reason for hiding this comment

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

In the first iteration of implementation we were planning to return the configs in the serverResponse so if it was empty we would return null, but as you pointed out now there is no reason to do that. I'll correct the code.

@wsusrasp
Copy link
Contributor Author

wsusrasp commented Sep 14, 2023

@patmmccann
On a side note about the fledge mechanism - would it be possible to add a method to retrieve the component auction configs for adunit manually instead of automatically running them? Similarly to how getAdserverTargetingForAdUnitCode works right now. The use-case for this scenario would be greater control on how the auctions are ran and in our specific case that our prebid request is being made before the gpt slots are registered, since they are configured to obtain ads from GAM immediately.

@wsusrasp
Copy link
Contributor Author

On a side note about the fledge mechanism - would it be possible to add a method to retrieve the component auction configs for adunit manually instead of automatically running them? Similarly to how getAdserverTargetingForAdUnitCode works right now. The use-case for this scenario would be greater control on how the auctions are ran and in our specific case that our prebid request is being made before the gpt slots are registered, since they are configured to obtain ads from GAM immediately.

The problem is that we are loading gpt asynchronously and it's not always available when required by prebid and changing this logic to load gpt first and then prebid would make the code run slower, as now it runs in parallel.

@skoklowski
Copy link
Contributor

@patmmccann On a side note about the fledge mechanism - would it be possible to add a method to retrieve the component auction configs for adunit manually instead of automatically running them? Similarly to how getAdserverTargetingForAdUnitCode works right now. The use-case for this scenario would be greater control on how the auctions are ran and in our specific case that our prebid request is being made before the gpt slots are registered, since they are configured to obtain ads from GAM immediately.

Additionally, it would enable running FLEGDE component auctions in any ad server - not just Google Ad Manager. But in that case maybe this module shouldn't be called "fledgeForGpt" but just "fledge" or even better "protectedAudienceApi" ;)

@patmmccann
Copy link
Collaborator

@wsusrasp GPT isn't available by the time the bids are back? Can you open your request as a new issue?

@skoklowski linking #9481 to your comment. Could you elaborate on how that would enable not using GAM, perhaps in the issue above? Are you envisioning the configs are submitted to a different top level auction runner, eg Microsoft, or that Prebid or the pub runs the top level?

Aside: I'll be in Germany next week if you want to meet up

@dgirardi
Copy link
Collaborator

would it be possible to add a method to retrieve the component auction configs for adunit manually instead of automatically running them? Similarly to how getAdserverTargetingForAdUnitCode

Targeting works on "complete" bids, so the control you refer to allows you (as the publisher) to pick winners. Fledge is different, only GPT has access to the auction result. The only control the publisher has is who to include in the auction, which is already possible with various combination of fledgeEnabled and ortb2Imp.ext.ae flags.

My understanding is that to do the equivalent of getAdserverTargeting (or, really, bidsBackHandler) we would need a live service running Prebid-controlled decision logic. The snag is that with this approach we cannot include GAM in the fledge auctions - GPT is gatekeeping it.

in our specific case that our prebid request is being made before the gpt slots are registered, since they are configured to obtain ads from GAM immediately.

I'm not sure I understand - wouldn't this be a problem regardless of fledge, if your slots are not waiting for Prebid?

@wsusrasp
Copy link
Contributor Author

@wsusrasp GPT isn't available by the time the bids are back? Can you open your request as a new issue?

@skoklowski linking #9481 to your comment. Could you elaborate on how that would enable not using GAM, perhaps in the issue above? Are you envisioning the configs are submitted to a different top level auction runner, eg Microsoft, or that Prebid or the pub runs the top level?

Aside: I'll be in Germany next week if you want to meet up

Returning raw config would make it possible to call runAdAuction from navigator, without the need for GPT

@wsusrasp
Copy link
Contributor Author

would it be possible to add a method to retrieve the component auction configs for adunit manually instead of automatically running them? Similarly to how getAdserverTargetingForAdUnitCode

Targeting works on "complete" bids, so the control you refer to allows you (as the publisher) to pick winners. Fledge is different, only GPT has access to the auction result. The only control the publisher has is who to include in the auction, which is already possible with various combination of fledgeEnabled and ortb2Imp.ext.ae flags.

My understanding is that to do the equivalent of getAdserverTargeting (or, really, bidsBackHandler) we would need a live service running Prebid-controlled decision logic. The snag is that with this approach we cannot include GAM in the fledge auctions - GPT is gatekeeping it.

in our specific case that our prebid request is being made before the gpt slots are registered, since they are configured to obtain ads from GAM immediately.

I'm not sure I understand - wouldn't this be a problem regardless of fledge, if your slots are not waiting for Prebid?

Our slots are waiting for prebid, but we set their config via getAdserverTargeting and they are defined after we make a call for bids. That's why if possible we'd like to be able to set the component configs manually on the slot. Would that be possible? Perhaps something like pbjs.fledge.getComponentConfigs(auctionId)? If needed, I can provide a draft in a separate PR.

@dgirardi
Copy link
Collaborator

dgirardi commented Sep 18, 2023

Our slots are waiting for prebid, but we set their config via getAdserverTargeting and they are defined after we make a call for bids.

Do you mean that the GPT slots are created only after running Prebid? Otherwise I think the existing flow should work. If it doesn't I'd like to understand why - since this is not the only place where Prebid looks up slots in GPT.

My understanding is that as long as the slot exists, the fledge setConfig should work even if done before your other configuration.

@wsusrasp
Copy link
Contributor Author

Our slots are waiting for prebid, but we set their config via getAdserverTargeting and they are defined after we make a call for bids.

Do you mean that the GPT slots are created only after running Prebid? Otherwise I think the existing flow should work. If it doesn't I'd like to understand why - since this is not the only place where Prebid looks up slots in GPT.

My understanding is that as long as the slot exists, the fledge setConfig should work even if done before your other configuration.

It is exactly as you said, the GPT slots are defined after running Prebid. I do not have the precise reason, although since we are loading GPT in parallel it would still lead to race condition. The simple fix is to force the GPT to load before prebid (in series) but that would increase the time for the ads to load.

@skoklowski
Copy link
Contributor

skoklowski commented Sep 19, 2023

@dgirardi: Both Prebid.js and GPT scripts are asynchronous. We load them in parallel to speed up time when ads are displayed. Thanks to this approach it's more likely that user won't leave the page until ads are displayed. In addition Active View metric should be better.

I will try to describe this process. Let's assume that we need for example 2 seconds for loading GPT script and only 1 second to load Prebid.js script. Additionally we set for example 0.8 seconds as a timeout for Prebid standard auctions (in fact this is timeout for bidders to respond).

Our current approach
We start Prebid auction immediately without waiting for GPT script to load so we can start fetching ads from Google Ad Manager after 2 seconds - exactly the moment when GPT script is loaded because in this example Prebid needs only 1.8 seconds to do its job.

Your approach
You need to wait for GPT script to be fully loaded before running Prebid auction (I don't mean Protected Audience API auction but ordinary Prebid auction) because publisher are not able to define any slot before full GPT API is available (defineSlot function is not defined before that moment). So ads can be fetched after 2.8 seconds even though Prebid script was loaded after 1 second.

Solution
There are two ways to resolve issue mentioned above:

  1. You would need to set auction config on GPT slot inside googletag.cmd.push(callback). This would change your code into asynchronous call - as callback has to be used. As far as I know it's not possible to do it in this specific fragment of Prebid code.
  2. You provide some function with all Protected Audience API auctions configuration so publisher may set auction config on desired GPT slots by oneself. Furthermore such function could be used also with with different ad servers. So you don't need to implement many different Prebid modules for every ad server which code would be almost exactly the same - the only difference would be using certain ad server SDK to set configuration of its internal Protected Audience API component auction.

@patmmccann patmmccann merged commit 2905b4c into prebid:master Oct 3, 2023
4 checks passed
@wsusrasp wsusrasp deleted the ras-fledge branch May 20, 2024 12:20
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.

None yet

5 participants