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

OpenX Video Adapter update to Prebid v1.0 #1724

Merged
merged 3 commits into from
Nov 13, 2017

Conversation

IHateCodesss
Copy link
Contributor

@IHateCodesss IHateCodesss commented Oct 18, 2017

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

OpenX Adapter for Prebid v1.0

  • test parameters for validating bids
{
  bidder: 'openx',
  mediaType: 'video',
     params: {
        unit: '539131525',
        delDomain: 'zdo.com',
        video: {
           url: 'abc.com'
        }
      }
}

Bidder code: openx
Send All Bids Ad Server Keys: hb_pb, hb_adid, hb_size
new openxvideo biddersettings:

pbjs.bidderSettings =
    {
        standard: {
          ........
        }
    };

Other information

The OpenX adapter requires setup and approval from your OpenX team. Please reach out to your OpenX representative or [email protected] for more information and to enable using this adapter

@dbemiller
Copy link
Contributor

hey @IHateCodesss ... did you plan on keeping the openx videoadapter separate from the banner one?

In Prebid adapters can support several media types, so there's only one needed for each company.

@IHateCodesss
Copy link
Contributor Author

Unfortunately, Yes, OpenX does not support multiple media types in a single request for now. We have different endpoints for different media type ad requests.

@mkendall07
Copy link
Member

to be clear, you could add logic that changes the endpoint to hit based on the media type. That might be easier to maintain than 2 separate adapters.

@dbemiller
Copy link
Contributor

The rubicon adapter, for example, makes several requests in a single auction.

const parts = oxResponseObj.match(/^[a-z0-9]+\(([^\)]+)\)/i);
let response = !parts || parts.length != 2 ? undefined : JSON.parse(parts[1]);
if (response && response.pixels) {
userSync.registerSync('iframe', 'openx', response.pixels);
Copy link
Contributor

Choose a reason for hiding this comment

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

1.0 adapters shouldn't be doing this. User syncs are fired after the auction has completed.

Implement getUserSyncs() on your spec instead: https://github.com/prebid/Prebid.js/blob/master/src/adapters/bidderFactory.js#L50

Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately, we do not have user sync pixel URLs available until after the bidResponse, which is why we're registering it as part of handling the response. The official doc here: http://prebid.org/dev-docs/bidder-adapter-1.html#register-user-syncs seems to say that we can do it either way. Has this been changed?

Copy link
Member

Choose a reason for hiding this comment

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

I think this is OK. We'll need to check and see if this queue get's emptied if it's after auction close.

Copy link
Contributor

@dbemiller dbemiller Oct 23, 2017

Choose a reason for hiding this comment

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

akh... I had a brain fart.

In interpretResponse calls createBidResponses, which calls buildBoPixel, which creates an Image and sets the src property--in effect, firing off a user sync in the middle of the auction.

I saw that, but must have lost my head and commented on the wrong line.

return !!(bid.params.unit || bid.params.delDomain);
},
buildRequests: function(bids) {
let isIfr;
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a utils.inIframe() for this.

let adUnit = adUnits[i];
let bidResponse = {};
bidResponse.requestId = bids[i].bidId;
bidResponse.bidderCode = BIDDER_CODE;
Copy link
Contributor

Choose a reason for hiding this comment

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

This... will actually break aliasing, in the bidderFactory.

I think our docs are misleading. Bidders don't need to send back bidderCode, because the bidderFactory does it for you. So you can remove this line.

beaconParams.bp = adUnit.pub_rev;
beaconParams.ts = adUnit.ts;
if (shouldSendBoPixel) {
buildBoPixel(adUnit.creative[0], beaconParams);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing here... pixel syncs aren't allowed during the actual auction. Implement this in getUserSyncs

Copy link
Contributor

Choose a reason for hiding this comment

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

This is for performance measurement and is not related to user syncing. Do you have other alternatives for us to report on performance measurements?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what you mean by "performance measurement." There are three mechanisms I've seen people do, depending on the case.

  1. Put the image inside the creative. The URL will get hit if it wins.
  2. Make an analytics adapter.
  3. Use userSync to call the URL after the auction has finished.

Yours is the first adapter I've seen doing this... so I checked in with @mkendall07 for the rules. The suggestion was to just use userSync anyway here, even though it's not exactly what you're doing.

@dbemiller
Copy link
Contributor

One more change, now that #1742 got merged.

The first argument to interpretResponse now looks like this:

{
  body: responseBody,
  headers: {
    get: function(header) { /* returns a header from the HTTP response */ }
  }
}

You'll have to update the spec so that it looks through that object as well now.

@IHateCodesss
Copy link
Contributor Author

@dbemiller Thanks for the review. We'd like to get this PR in first: #1714. This one (#1724) will be the next for this release also. I will keep updating this PR according to your comments and the update in this PR #1714

@dbemiller
Copy link
Contributor

dbemiller commented Oct 26, 2017

Ok. I'll tag this PR as in progress until #1714 goes in.

@IHateCodesss
Copy link
Contributor Author

Thanks very much!

@dbemiller
Copy link
Contributor

ok... I just heard that your first one got merged in. So I can review this once the conflicts are fixed.

@ndhimehta ndhimehta added the ready label Nov 6, 2017
@IHateCodesss IHateCodesss force-pushed the prebid-1.0-oxvideoadapter branch from 768f8a2 to 0038e8e Compare November 7, 2017 19:32
@IHateCodesss IHateCodesss deleted the prebid-1.0-oxvideoadapter branch November 7, 2017 19:42
@IHateCodesss IHateCodesss reopened this Nov 7, 2017
@IHateCodesss
Copy link
Contributor Author

@dbemiller Thanks for ur help. Just update the PR with no conflict now.

@IHateCodesss IHateCodesss force-pushed the prebid-1.0-oxvideoadapter branch from c25ceb5 to 68e299e Compare November 8, 2017 02:56
Copy link
Contributor

@dbemiller dbemiller left a comment

Choose a reason for hiding this comment

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

I'm not getting any bids back, using your video params from the .md file.

The terminal says that the server call is returning a 400.

});

it('handles nobid responses', () => {
bidResponse = {'cache_key': '', 'pub_rev': '', 'per_colo_domain': '', 'ph': ''};
Copy link
Contributor

Choose a reason for hiding this comment

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

Tests shouldn't have side-effects

@IHateCodesss
Copy link
Contributor Author

@dbemiller I just update the unit tests to avoid side-effects and the ad domain in .md file

@dbemiller
Copy link
Contributor

@IHateCodesss ok, tests look fine now and I'm definitely getting a response back from the server.

...but it doesn't look like it's a video bid?

The mediaType is banner, and it doesn't have a vastUrl or vastXml or anything like that.

This is what makes it into the _bidsReceived array:

screen shot 2017-11-09 at 9 03 26 am

@IHateCodesss
Copy link
Contributor Author

IHateCodesss commented Nov 10, 2017

@dbemiller I just fix this. BTW, are 'width' and 'height' required in response? When I did test for undefined width and height, ad delivery still worked and I saw ad rendered

@IHateCodesss IHateCodesss force-pushed the prebid-1.0-oxvideoadapter branch from 02f7b59 to f17206f Compare November 10, 2017 01:34
@IHateCodesss IHateCodesss force-pushed the prebid-1.0-oxvideoadapter branch from f17206f to 73e14eb Compare November 10, 2017 06:57
@dbemiller
Copy link
Contributor

No worries there. Video bids should be fine without a width & height.

@@ -13,6 +13,11 @@ export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: SUPPORTED_AD_TYPES,
isBidRequestValid: function(bid) {
if (bid.mediaType === VIDEO) {
Copy link
Member

Choose a reason for hiding this comment

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

It's worth noting that there is another way to define a video bid now. I'm not going to hold up this PR though since it's been sitting for awhile. You can see the pattern here: https://github.com/prebid/Prebid.js/blob/master/modules/appnexusAstBidAdapter.js#L291

If you want, please open a new PR with this small change. Thanks

@mkendall07 mkendall07 merged commit 0d6868a into prebid:master Nov 13, 2017
Millerrok pushed a commit to Vertamedia/Prebid.js that referenced this pull request Nov 21, 2017
* unstream/master: (36 commits)
  + Add Optimatic Bid Adapter (prebid#1837)
  Add Bridgewell adapter (prebid#1825)
  Kumma adapter updated for Prebid 1.0 (prebid#1766)
  Touchup add bid response (prebid#1822)
  Fix skipped test (prebid#1836)
  Added new size in Rubicon pbjs Adapter (prebid#1842)
  HuddledMasses header bidding adapter (prebid#1806)
  Increment pre version
  Prebid 0.33.0 Release
  Update AOL adapter for v1.0  (prebid#1693)
  Sovrn 1.0 compliance (prebid#1796)
  Platform.io Bidder Adapter update (prebid#1817)
  Drop non-video bidders from video ad units (prebid#1815)
  Update renderAd to replace ${AUCTION_PRICE} in adUrl (prebid#1795)
  Pulsepoint adapter: fixing bid rejection due to missing mandatory bid params. (prebid#1823)
  Remove require.ensure entirely (prebid#1816)
  Add custom keyword support for pbs bid adapter (prebid#1763)
  OpenX Video Adapter update to Prebid v1.0 (prebid#1724)
  Fix test that hard-coded pbjs global. (prebid#1786)
  Update Pollux Adapter to v1.0 (prebid#1694)
  ...
vzhukovsky added a commit to aol/Prebid.js that referenced this pull request Dec 28, 2017
….33.0 to aolgithub-master

* commit '3e9756098bb20ecbe0314f16eed5298c5675b24c': (32 commits)
  Wrapped content type in options object.
  Added partners ids.
  Added changelog entry.
  Prebid 0.33.0 Release
  Update AOL adapter for v1.0  (prebid#1693)
  Sovrn 1.0 compliance (prebid#1796)
  Platform.io Bidder Adapter update (prebid#1817)
  Drop non-video bidders from video ad units (prebid#1815)
  Update renderAd to replace ${AUCTION_PRICE} in adUrl (prebid#1795)
  Pulsepoint adapter: fixing bid rejection due to missing mandatory bid params. (prebid#1823)
  Remove require.ensure entirely (prebid#1816)
  Add custom keyword support for pbs bid adapter (prebid#1763)
  OpenX Video Adapter update to Prebid v1.0 (prebid#1724)
  Fix test that hard-coded pbjs global. (prebid#1786)
  Update Pollux Adapter to v1.0 (prebid#1694)
  PubMatic adapter (prebid#1707)
  Added sizes to Rubicon Adapter (prebid#1818)
  jsonpFunction name should match the namespace (prebid#1785)
  Adding 33Across adapter (prebid#1805)
  Unit test fix (prebid#1812)
  ...
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
* Add video support

* remove side-effects in unit tests and update test ad domain

* Add mediaType adn vastUrl for video reponse
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.

7 participants