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

Add improvedigitalBidAdapter #1381

Merged
merged 12 commits into from
Aug 30, 2017
Merged

Add improvedigitalBidAdapter #1381

merged 12 commits into from
Aug 30, 2017

Conversation

agregorio-improve
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

  • test parameters for validating bids
{
  bidder: 'improvedigital',
  params: {
    placementId:1053688
  }
},
{
  bidder: 'improvedigital',
  params: {
    placementId:1053689,
    keyValues: {
      testKey: ["testValue"]
    }
},
{
  bidder: 'improvedigital',
  params: {
    placementId:1053687,
    size: {
      w:300,
      h:300
    }
}

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

Other information

Copy link
Collaborator

@harpere harpere left a comment

Choose a reason for hiding this comment

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

@agregorio-improve before reviewing the adapter code itself - it needs unit tests. You can see examples in test/spec/modules/

@derdeka
Copy link
Contributor

derdeka commented Aug 1, 2017

The length of the bidder name "improvedigital" is to long when using enableSendAllBids() with dfp (hb_size_improvedigital, hb_adid_improvedigital, hb_pb_improvedigital). The limit of dfp's key length is 20. Please use a shorter name or register an alias.

};

ImproveDigitalAdapter.createNew = function () {
return new BeachfrontAdapter();
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is BeachfrontAdapter defined? This should be ImproveDigitalAdapter, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed to ImproveDigitalAdapter.


var ImproveDigitalAdapter = function ImproveDigitalAdapter() {
var IMPROVE_DIGITAL_BIDDER_CODE = "improvedigital";
var baseAdapter = Adapter.createNew(IMPROVE_DIGITAL_BIDDER_CODE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Adapter.createNew no longer exists. this should be var baseAdapter = new Adapter(IMPROVE_DIGITAL_BIDDER_CODE);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has now been fixed in the latest version.

getNormalizedBidRequest: baseAdapter.getNormalizedBidRequest,
callBids: baseAdapter.callBids
};
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will need change to (see #1459)

return Object.assign(this, {
    LIB_VERSION: LIB_VERSION,
    idClient: baseAdapter.idClient,
    getNormalizedBidRequest: baseAdapter.getNormalizedBidRequest,
    callBids: baseAdapter.callBids
  });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has also been fixed in the latest version.

@agregorio-improve
Copy link
Contributor Author

I have now added unit tests and made fixes as per your comments.

I have not set up an alias because it seems that the latest implementation of enableSendAllBids seems to truncate the keys to 20 characters. Is aliasing still required?

@agregorio-improve
Copy link
Contributor Author

Hello,

Can you please take a look at and approve the latest changes?

Best Regards,
Alfredo

Copy link
Collaborator

@muuki88 muuki88 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 marks regarding style. Otherwise this LGTM

@@ -0,0 +1,408 @@
var LIB_VERSION_GLOBAL = '3.0.2';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

var adaptermanager = require('src/adaptermanager');

const ImproveDigitalAdapter = function () {
var IMPROVE_DIGITAL_BIDDER_CODE = 'improvedigital';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll use const where ever possible. And let instead of var for the rest.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The bidder code is also used in the createNew function. Maybe extracting this into a const would be a good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

singleRequestMode: false,
httpRequestType: this.idClient.CONSTANTS.HTTP_REQUEST_TYPE.GET,
callback: CALLBACK_FUNCTION,
secure: (loc.protocol === 'https:') ? 1 : 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not true and false instead of 1 and 0?

);

if (request.errors && request.errors.length > 0) {
console.log('ID WARNING 0x01');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does prebid.js not have any logging facilities?

Copy link
Contributor

Choose a reason for hiding this comment

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

src/utils has logWarn and logError functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the logging to utils.logError.

0 and 1 instead of true or false is a throwback to our internal protocol


var baseUrl = (requestParameters.secure === 1 ? 'https' : 'http') + '://' + this.CONSTANTS.AD_SERVER_BASE_URL + '/';

var bidRequestObject;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not initialize here directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@agregorio-improve
Copy link
Contributor Author

All concerns have been addressed and automated checks are passing. Please approve the pull request.

Copy link
Collaborator

@muuki88 muuki88 left a comment

Choose a reason for hiding this comment

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

LGTM

@agregorio-improve
Copy link
Contributor Author

Hi,

I don't see the approval. Merge is still blocked. Can you please take a look?

Cheers.
Alfredo

@muuki88
Copy link
Collaborator

muuki88 commented Aug 21, 2017

@agregorio-improve I'm not a maintainer or contributor, so I can just give my approval, but not actually merge. @dbemiller or @harpere can do this.

@mkendall07
Copy link
Member

@agregorio-improve
There needs to some updates on this before we can merge. Thanks

@agregorio-improve
Copy link
Contributor Author

All comments have been addressed. Please approve this merge request.

Copy link
Collaborator

@jaiminpanchal27 jaiminpanchal27 left a comment

Choose a reason for hiding this comment

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

LGTM

@agregorio-improve
Copy link
Contributor Author

Looks like @harpere did not approve my changes despite the fact that I have addressed all the issues specified. Can someone please remove this block?

@agregorio-improve
Copy link
Contributor Author

Thank you @muuki88 and @jaiminpanchal27 but it looks like @harpere is still blocking this. Anything you can do?

@agregorio-improve
Copy link
Contributor Author

Hi,

Can someone unblock this please?

Regards,
Alfredo

@Re-lM
Copy link

Re-lM commented Aug 28, 2017

Hi all,
What is the status of this one? Can it be merged?
Thanks!

Copy link
Member

@mkendall07 mkendall07 left a comment

Choose a reason for hiding this comment

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

Few comments to address then this is mergeable.

const LIB_VERSION_GLOBAL = '3.0.5';

var CONSTANTS = require('src/constants');
var utils = require('src/utils');
Copy link
Member

Choose a reason for hiding this comment

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

we prefer let and const over var

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

let LIB_VERSION = LIB_VERSION_GLOBAL;

// Ad server needs to implement JSONP using this function as the callback
let CALLBACK_FUNCTION = '$$PREBID_GLOBAL$$' + '.improveDigitalResponse';
Copy link
Member

Choose a reason for hiding this comment

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

FYI we won't allow JSONP callbacks with prebid 1.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We support CORS and will update our adapter when required by prebid 1.0.

if (bidObject.id === bidRequest.bidId) {
let bid;
if (!bidObject.price || bidObject.price === null) {
bid = bidfactory.createBid(CONSTANTS.STATUS.NO_BID, bidRequest);
Copy link
Member

Choose a reason for hiding this comment

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

repeated code blocks should go into a function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.


let nurl = '';
if (bidObject.nurl && bidObject.nurl.length > 0) {
nurl = '<img src=\"' + bidObject.nurl + '\" width=\"0\" height=\"0\" style=\"display:none\">';
Copy link
Member

Choose a reason for hiding this comment

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

prefer template literals over string concatenation. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@mkendall07
Copy link
Member

@agregorio-improve @Re-lM
let a few comments.

@agregorio-improve
Copy link
Contributor Author

All outstanding issues have been addressed. Please provide feedback and/or approve merge.

let syncInd = syncElement.replace(/\//g, '\\\/');
syncString += '<img src=\\\"' + syncInd + '\\\"\/>';
syncString = `${syncString}${(syncString === '') ? 'document.writeln(\"' : ''}<img src=\\\"${syncInd}\\\" style=\\\"display:none\\\"\/>`;
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to escape " anymore

@mkendall07 mkendall07 merged commit 65b34c8 into prebid:master Aug 30, 2017
ptomasroos pushed a commit to happypancake/Prebid.js that referenced this pull request Sep 1, 2017
* Add improvedigitalBidAdapter

* Add unit tests.  Miscellaneous Fixes

* Code review changes

* Second level CR changes

* Fix possible undefined error

* Replace var with let and const.  Move duplicate code to function.  Use templates instead of string concatenation
philipwatson pushed a commit to mbrtargeting/Prebid.js that referenced this pull request Sep 18, 2017
* Add improvedigitalBidAdapter

* Add unit tests.  Miscellaneous Fixes

* Code review changes

* Second level CR changes

* Fix possible undefined error

* Replace var with let and const.  Move duplicate code to function.  Use templates instead of string concatenation
outoftime pushed a commit to Genius/Prebid.js that referenced this pull request Sep 18, 2017
* tag '0.28.0' of https://github.com/prebid/Prebid.js: (27 commits)
  Prebid 0.28.0 Release
  Revert "Upgrade sinon to 3.x (prebid#1491)" (prebid#1563)
  add () for correct order of operations in scaling increments for currency (prebid#1559)
  AppnexusAst adapter update: Added source and version to request payload (prebid#1555)
  remove unnecessary spread operator (prebid#1561)
  Adxcg adapter (prebid#1554)
  Upgrade sinon to 3.x (prebid#1491)
  Rename vastPayload to vastXml (prebid#1556)
  Single-size sizes array now can be taken, too (prebid#1535)
  Updated the istanbul-instrumenter-loader (prebid#1550)
  Add AerServ Adapter (prebid#1538)
  Fixed imports and made adform support aliasing (prebid#1518)
  Custom granularity fix (prebid#1546)
  Fix `documentation lint` issues (prebid#1544)
  Yieldbot adunit bidder params slot name usage fix (prebid#1394)
  Update serverbid adapter to use smartsync (prebid#1324)
  Add improvedigitalBidAdapter (prebid#1381)
  Fix prebid#1533 spring server typo (prebid#1542)
  userSync is off by default (prebid#1543)
  currency module (prebid#1374)
  ...
jbAdyoulike pushed a commit to jbAdyoulike/Prebid.js that referenced this pull request Sep 21, 2017
* Add improvedigitalBidAdapter

* Add unit tests.  Miscellaneous Fixes

* Code review changes

* Second level CR changes

* Fix possible undefined error

* Replace var with let and const.  Move duplicate code to function.  Use templates instead of string concatenation
vzhukovsky added a commit to aol/Prebid.js that referenced this pull request Oct 12, 2017
….28.0 to aolgithub-master

* commit '4d9ade3df767750743f8888ed9efd6c77f8d0050': (26 commits)
  Added changelog entry.
  Added new aol partners ids.
  Prebid 0.28.0 Release
  Revert "Upgrade sinon to 3.x (prebid#1491)" (prebid#1563)
  add () for correct order of operations in scaling increments for currency (prebid#1559)
  AppnexusAst adapter update: Added source and version to request payload (prebid#1555)
  remove unnecessary spread operator (prebid#1561)
  Adxcg adapter (prebid#1554)
  Upgrade sinon to 3.x (prebid#1491)
  Rename vastPayload to vastXml (prebid#1556)
  Single-size sizes array now can be taken, too (prebid#1535)
  Updated the istanbul-instrumenter-loader (prebid#1550)
  Add AerServ Adapter (prebid#1538)
  Fixed imports and made adform support aliasing (prebid#1518)
  Custom granularity fix (prebid#1546)
  Fix `documentation lint` issues (prebid#1544)
  Yieldbot adunit bidder params slot name usage fix (prebid#1394)
  Update serverbid adapter to use smartsync (prebid#1324)
  Add improvedigitalBidAdapter (prebid#1381)
  Fix prebid#1533 spring server typo (prebid#1542)
  ...
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
* Add improvedigitalBidAdapter

* Add unit tests.  Miscellaneous Fixes

* Code review changes

* Second level CR changes

* Fix possible undefined error

* Replace var with let and const.  Move duplicate code to function.  Use templates instead of string concatenation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants