Skip to content

realvuBidAdapter #1571

Merged
jaiminpanchal27 merged 24 commits intoprebid:masterfrom
tchibirev:master
Oct 20, 2017
Merged

realvuBidAdapter #1571
jaiminpanchal27 merged 24 commits intoprebid:masterfrom
tchibirev:master

Conversation

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

Description of change

New 'realvu' Bid Adapter

  • test parameters for validating bids
{
  bidder: 'realvu',
  params: {
     partnerId: '1Y',
     placementId: '9339508'
  }
}

Be sure to test the integration with your adserver using the Hello World sample page.

  • contact email of the adapter’s maintainer
    it@realvu.com
  • official adapter submission

Other information

Copy link
Collaborator

@matthewlane matthewlane left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I wasn't able to validate bids with the provided test parameters, please advise if those are still the correct params to test with. Also a few comments below for your review

var callbackId = bid_request.bidId;
// utils.logMessage('realvuBidAdapter boost callback "' + callbackId + '", rez.realvu=' + rez.realvu);
if (rez.realvu === 'yes') {
var adap = new AppnexusAdapter();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Importing and using other adapters isn't generally recommended as it may result in unexpected behavior. What is the desired behavior here? Would creating a new alias bid adapter in appnexusBidAdapter fit this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Creating a new alias is not exactly what we need. RealVu adaper define either an ad unit is in view or not. Only if an ad unit is in view realvu adapter calls Appnexus. If the unit is out of view "no bid" is responded without request to server.

Copy link
Collaborator

Choose a reason for hiding this comment

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

appnexusBidAdapter still shouldn't be imported though, but you can copy the buildJPTCall function and include it (or just the required parts) directly in this module

for (var i = 0; i < pbids.length; i++) {
var bid_rq = pbids[i];
var sizes = utils.parseSizesInput(bid_rq.sizes);
top.realvu_boost.addUnitById({
Copy link
Collaborator

Choose a reason for hiding this comment

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

References to top should be placed in a try/catch block to prevent possible uncaught TypeErrors

@tchibirev
Copy link
Contributor Author

try-catch has been added to access top window.

Copy link
Collaborator

@matthewlane matthewlane left a comment

Choose a reason for hiding this comment

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

A few more comments for review, and please provide testing parameters we can use to verify bid responses. See this file for an example of the pages we test bidder adapters with

var callbackId = bid_request.bidId;
// utils.logMessage('realvuBidAdapter boost callback "' + callbackId + '", rez.realvu=' + rez.realvu);
if (rez.realvu === 'yes') {
var adap = new AppnexusAdapter();
Copy link
Collaborator

Choose a reason for hiding this comment

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

appnexusBidAdapter still shouldn't be imported though, but you can copy the buildJPTCall function and include it (or just the required parts) directly in this module

@@ -0,0 +1,64 @@
import adaptermanager from 'src/adaptermanager';

var utils = require('src/utils.js');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer const for require statements and anywhere else in the module they can be used in place of var

@tchibirev
Copy link
Contributor Author

Following recommendations appnexusBidAdapter was included inline.

@tchibirev
Copy link
Contributor Author

Can we move forward with this adapter?

@matthewlane
Copy link
Collaborator

We still need test parameters for validating bids with this adapter. The params

{
  bidder: 'realvu',
  params: {
     partnerId: '1Y',
     placementId: '9339508'
  }
}

are not returning anything. Please update these or point us to a testing page and we can review

@tchibirev
Copy link
Contributor Author

Evidently in your test you have referrer=localhost so an ad server responds with no-bid.
Please use this test page: http://control.realvu.net/prebid/realvuBidAdapterTest.aspx

var baseAdapter = new Adapter('appnexus');
var usersync = false;

baseAdapter.callBids = function (params) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you using this callBids anywhere ? I think its not getting used, you can remove it.


// +copy/pasted appnexusBidAdapter, "handleAnCB" replaced with "handleRvAnCB"
var RvAppNexusAdapter = function RvAppNexusAdapter() {
var baseAdapter = new Adapter('appnexus');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need baseAdapter here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected code is committed


// var bidsCount = anArr.length;

// set expected bids count for callback execution
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove unwanted code

var callbackId = bidRequest.bidId;
adloader.loadScript(buildJPTCall(bidRequest, callbackId));

// store a reference to the bidRequest from the callback id
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove unwanted code

// @endif
}
};
/*
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove unwanted code

start: 1504628062271
};

var bidResponseStub = sinon.stub(bidmanager, 'addBidResponse');
Copy link
Collaborator

Choose a reason for hiding this comment

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

stub needs to be defined and restored in beforeEach and afterEach hooks to avoid errors.

adapter = new Adapter();

describe('load boost', () => {
adapter.callBids(REQUEST);
Copy link
Collaborator

Choose a reason for hiding this comment

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

These test cases are not getting executed.
Your test cases need to be in it. describe is grouping of test cases.
This https://gist.github.com/samwize/8877226 can be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test cases are reorganized.

@jaiminpanchal27
Copy link
Collaborator

@tchibirev Checks are failing due to linting errors. Also check code coverage using gulp test-coverage and gulp view-coverage

@tchibirev
Copy link
Contributor Author

Could you take a look at last commit?

@jaiminpanchal27 jaiminpanchal27 merged commit 37b218a into prebid:master Oct 20, 2017
Millerrok pushed a commit to Vertamedia/Prebid.js that referenced this pull request Oct 25, 2017
* 'master' of https://github.com/prebid/Prebid.js: (414 commits)
  Make response headers available to the specs (prebid#1748)
  add option to run tests in a specific file (prebid#1727)
  Update JCM Adapter to 1.0  (prebid#1715)
  Finished an unfinished comment. (prebid#1749)
  Platform.io Bidder Adapter update.  Prebid v1.0. (prebid#1705)
  Fix window.top.host cross origin issue when in nested iframes. (prebid#1730)
  fix log message not displaying when referencing missing bidder (prebid#1737)
  Allow more than one placement from one page (prebid#1692)
  Justpremium Adapter bugfix (prebid#1716)
  Updating license (prebid#1717)
  realvuBidAdapter  (prebid#1571)
  Update JSDoc to call the module `pbjs` (prebid#1572)
  Update Beachfront adapter for v1.0 (prebid#1675)
  Update AdButler adapter for Prebid v1.0 (prebid#1664)
  Increment pre version
  Fix for prebid#1628 (allowing standard bidCpmAdjustment) (prebid#1645)
  Prebid 0.31.0 Release
  Support native click tracking (prebid#1691)
  Initial commit for video support for pbs (prebid#1706)
  Fixes: Immediate adapter response may end auction (prebid#1690)
  ...
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.

4 participants

Comments