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

Adapter instance communication #1820

Closed
elljoh opened this issue Nov 9, 2017 · 3 comments
Closed

Adapter instance communication #1820

elljoh opened this issue Nov 9, 2017 · 3 comments
Labels

Comments

@elljoh
Copy link
Contributor

elljoh commented Nov 9, 2017

Question

If an adapter needs to share request parameter state to optimize requests, or indeed to support SRA as indicated in #891, is postMessage() to window.parent the recommended technique.

Or do you expect to have an adapter context object/API to support adapter instance communication?

In some respects, I read the two requirements below as somewhat opposed.

Thanks, John

Ref: #891

All adapters must support the creation of multiple instances.

Adapters should support a single request architecture (SRA), making a single bid request per page load which supports multiple adunits and multiple sizes per adunit.

@mkendall07
Copy link
Member

mkendall07 commented Nov 14, 2017

Hey @elljoh
Each adapter instance would send it's own request. The single request architecture is meant for each instance running. So you shouldn't need to coordinate between the different instances. Hope that clarifies.

@elljoh
Copy link
Contributor Author

elljoh commented Nov 15, 2017

@mkendall07 thanks. it occurs to me that I may have been misinterpreting what "adapter instance" means.

Incorrectly I have, for some reason (?), been carrying a mental model of an adapter instance being related to a bid request for a particular slot... more akin to an "execution" :\

Whereas an "adapter instance" is a newly instantiated and registered adapter object.

My concern was that, for example, an adapter instance might wish to keep a count of bid requests and provide this or other variables kept in memory as Url query parameters in the bid request in order to optimize demand partner bids.

For a page visit if there is a single adapter instance, keeping state w/in the adapter implementation is fine.

However, there are scenarios where this could be a limitation. For example:

  1. If a demand partner optimizes bids according to a page visit session and there are > 1 adapter instances, publisher monetization may not be optimal; and
  2. There is state from session to session that would also be desirable for optimization of bids.

Based on #2, kargoBidAdapter.js, is it acceptable in Prebid 1.0 adapter implementations to use cookie, sessionStorage and localStorage? This does give adapters the ability to maintain instance state across sessions.

...and indeed gives some form of communications b/w adapter instances, although simply postMessage or some other Prebid.js adapter API handling of this might be my preference when adapter instances are sandboxed.

@mkendall07
Copy link
Member

@elljoh
Sorry for the late reply. Yes we are allowing use of cookie and localStorage. That can be used if desired to coordinate between instances of adapters.

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

No branches or pull requests

2 participants