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

Inject a mock bid #12261

Closed
EskelCz opened this issue Sep 19, 2024 · 5 comments
Closed

Inject a mock bid #12261

EskelCz opened this issue Sep 19, 2024 · 5 comments

Comments

@EskelCz
Copy link
Contributor

EskelCz commented Sep 19, 2024

Type of issue

Question

Description

Is there a way to inject my own testing bid via the debugging module? I know about intercept, but that just changes the current bids.
In ad ops there are many issues downstream (in rendering) that often need fixing/testing before we start getting bids, and that leaves us stuck. It would save us a lot of time/work to have such capability.

I have found some discussion on the topic here, but can't find if it resulted in anything real: #4461

Thanks for consideration.

@dgirardi
Copy link
Collaborator

In ad ops there are many issues downstream (in rendering) that often need fixing/testing before we start getting bids, and that leaves us stuck. It would save us a lot of time/work to have such capability.

You can use intercept to inject any creative (then: {ad: ...}, or adUrl). Otherwise could you elaborate on what you're trying to do?

@patmmccann
Copy link
Collaborator

@EskelCz it seems we should add an example forced bid to this page: https://docs.prebid.org/dev-docs/modules/debugging.html#replace-rules

Are you looking for an example to change the bidder of an existing response?

Do you need a banner example of Image

@patmmccann patmmccann moved this from Triage to Needs OP in Prebid.js Tactical Issues table Sep 23, 2024
@EskelCz
Copy link
Contributor Author

EskelCz commented Sep 24, 2024

@patmmccann Banner example would be a good addition. But from my understanding the intercept system has two limitations:

  1. It cannot change the bidder (At least when I tried that I got a warning, something about using an unsupported alias for the bidder)
  2. It can only change received bids, not add anything new in a situation when I am not receiving ANY bids.
    Is this correct?

I have worked around this using magnite demand simulator or other tools to mock network requests, but it's not a convenient. Prebid debugging code can be more easily shared with a third party for example.

@dgirardi
Copy link
Collaborator

It can only change received bids, not add anything new in a situation when I am not receiving ANY bids.
Is this correct?

It works by intercepting bid requests and mocking the normal adapter request/response flow (but I realize now that the documentation is not clear on this). Stylized, the normal flow is:

  1. Ad unit definitions are transformed into bid requests (for each ad unit, a bid request for each of its .bids)
  2. Bid requests are filtered through adapters' isBidRequestValid
  3. Valid bid requests are transformed to network requests via adapters' buildRequests
  4. Network responses are transformed to bid responses via adapters' interpretResponse

When an intercept rule matches a bid request, steps 3 and 4 are skipped, and to the rest of Prebid it looks like the adapter's interpretResponse replied with the object generated from then.

So you should be able to use it to simulate a bid when the actual exchange won't bid. The limitation is that you need a bid request to start with (but you can always just add another entry in .bids), and it needs to pass normal validation.

@EskelCz
Copy link
Contributor Author

EskelCz commented Sep 25, 2024

@dgirardi Ok thanks for the explanation. Not sure why it didn't work for me. I'll close this for now and maybe reopen once I come across it again and have some details to share.

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

No branches or pull requests

3 participants