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

Optimize AOL adapter and heavily reduce the size #653

Merged
merged 4 commits into from
Oct 13, 2016

Conversation

marian-r
Copy link
Member

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
  • Other

Description of change

  • Refactoring of the AOL adapter, optimizing the logic.
  • Removing additional request for a JavaScript library, thus improving performance, reducing the delay and bandwidth usage.
  • AOL adapter now also supports deals.
  • Adding unit tests (100% code coverage).
  • Adding Number.isInterger() polyfill.

Other information

AOL adapter is now maintained by @aol/header-bidding team.

- no aditional request for a JavaScript library
- also supports deals
- unit tests
- Number.isInterger() polyfill
@CLKeenan
Copy link
Contributor

This is great news!! Really looking forward to this.

@marian-r
Copy link
Member Author

I think the failed build was not caused by the changes introduced in this PR. It might be related to #642.

ajax(pubapiUrl, (response) => {
if (!response && response.length <= 0) {
utils.logError('Empty bid response', BIDDER_CODE, bid);
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

For an empty bid response, you will still want to add a bid response, likely with _addErrorBidResponse.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. This is now fixed.

@nedstankus
Copy link
Contributor

I'm seeing issues with the window=window assignment that's in loaders/delimiterLoader.js. You can see this on the example pages; e.g., http://localhost:9999/integrationExamples/gpt/pbjs_example_gpt.html

screen shot 2016-09-27 at 3 00 55 pm

@marian-r
Copy link
Member Author

@nedstankus that is not part of this PR. You are not testing the correct git branch. Please use contrib/optimized-aol-adapter branch.

@nedstankus
Copy link
Contributor

@marian-r You're correct--contrib/optimized-aol-adapter does not have that issue. I was on master.

@marian-r
Copy link
Member Author

marian-r commented Oct 4, 2016

Are there still any issues/concerns regarding this PR? It has been marked as 'needs review' so do you have an estimate of when the PR could be reviewed?

@protonate
Copy link
Collaborator

I should be able to review today or tomorrow, thanks for your patience.

@marian-r
Copy link
Member Author

marian-r commented Oct 7, 2016

These update of AOL adapter also changes the way how gross to net price calculations are handled for AOL bidder. Would it be possible to include a note about this change in the release notes once this is released? I would suggest something like this:

If you're using AOL as a bidder, please contact your Marketplace account team for a quick config fix (not doing gross to net config client side) as it's now done server side for AOL.

And do you have any estimate of when this could be released? Is it possible to include this in the 0.14.0 milestone?

@mkendall07 mkendall07 added this to the Prebid 0.14.0 milestone Oct 7, 2016
@mkendall07
Copy link
Member

@marian-r
Thanks for the info. Yes we can include that info in the release notes. I've added to 0.14.0 milestone

Copy link
Collaborator

@protonate protonate left a comment

Choose a reason for hiding this comment

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

This looks great, thanks for the submission. As noted an empty seatbid array in the response shouldn't throw an error as this is normal "no bid" response. Also if possible to sync the bid request/response IDs.

if (!bid) {
utils.logError('mismatched bid: ' + context.placement, ADTECH_BIDDER_NAME, context);
try {
bidData = response.seatbid[0].bid[0];
Copy link
Collaborator

Choose a reason for hiding this comment

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

An empty bid or "no bid" response causes this to fail which throws an error, though a response with an empty seatbid array appears to be common in my testing, so should be handled as other than Error.

Copy link
Member Author

Choose a reason for hiding this comment

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

When an error is thrown here, addErrorBidResponse() is called, which adds bid response to the bidmanager with status 2 (empty or error bid response). That, I believe, is correct behavior, but I removed error logging, so it won't appear as error in the console when debugging. That was done in 981fb75.

var bidreq = _mapUnit(bid);
window.ADTECH.loadAd(bidreq);
});
var bidResponse = bidfactory.createBid(1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider setting the bid response ID to match the bid request ID as described here: #509.

Doing so will position the adapter to take advantage of Prebid Roadmap features such as secure iframe support, improved analytics, Prebid Auctions and so on.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for this suggestion. Done in 38bd3ae.


// add it to the bid manager
function _addErrorBidResponse(bid, response = {}) {
var bidResponse = bidfactory.createBid(2);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider setting the bid response ID to match the bid request ID as described here: #509.

Doing so will position the adapter to take advantage of Prebid Roadmap features such as secure iframe support, improved analytics, Prebid Auctions and so on.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for this suggestion. Done in 38bd3ae.

@marian-r
Copy link
Member Author

All issues have been addressed.

if (cpm === null || isNaN(cpm)) {
return _addErrorBid(response, context);
if (!SERVER_MAP.hasOwnProperty(regionParam)) {
console.warn(`Unknown region '${regionParam}' for AOL bidder.`);
Copy link
Member

Choose a reason for hiding this comment

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

console.warn doesn't play nice in IE 9. Please use utils.logWarn instead for safety.

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason for using console.warn() directly is that this warning is meant to be shown when a publisher is configuring a site and uses incorrect region. I want to show the warning even if the debug mode is turned off, so the publisher can see what's wrong. And I expect publisher to be configuring it in a browser other than IE9 🤔. After the site is configured correctly, the warning should go away, so I believe it is safe to use this console.warn(). If you feel otherwise, please let me know.

Copy link
Member

Choose a reason for hiding this comment

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

fair enough I suppose. Thanks

@mkendall07
Copy link
Member

@marian-r
Thanks for updating the adapter and adding tests. My last request for you is if you could provide us with test params that return bids for use in our integration testing. Thank you!

@mkendall07 mkendall07 assigned mkendall07 and unassigned protonate Oct 12, 2016
@mkendall07 mkendall07 merged commit 38a2d25 into prebid:master Oct 13, 2016
@marian-r
Copy link
Member Author

@mkendall07 thanks for merging. I'm just following with the testing params:

This is for 728x90 placements:

{
  bidder: 'aol',
  params: {
    network: '9599.1',
    placement: 3675022 // 728x90
  }
}

This is for 300x250 placements:

{
  bidder: 'aol',
  params: {
    network: '9599.1',
    placement: 3675026 // 300x250
  }
}

Please let me know whether they work.

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.

6 participants