-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
There was a problem hiding this 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/
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. |
modules/improvedigitalBidAdapter.js
Outdated
}; | ||
|
||
ImproveDigitalAdapter.createNew = function () { | ||
return new BeachfrontAdapter(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
modules/improvedigitalBidAdapter.js
Outdated
|
||
var ImproveDigitalAdapter = function ImproveDigitalAdapter() { | ||
var IMPROVE_DIGITAL_BIDDER_CODE = "improvedigital"; | ||
var baseAdapter = Adapter.createNew(IMPROVE_DIGITAL_BIDDER_CODE); |
There was a problem hiding this comment.
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);
There was a problem hiding this comment.
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.
modules/improvedigitalBidAdapter.js
Outdated
getNormalizedBidRequest: baseAdapter.getNormalizedBidRequest, | ||
callBids: baseAdapter.callBids | ||
}; | ||
}; |
There was a problem hiding this comment.
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
});
There was a problem hiding this comment.
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.
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? |
Hello, Can you please take a look at and approve the latest changes? Best Regards, |
There was a problem hiding this 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
modules/improvedigitalBidAdapter.js
Outdated
@@ -0,0 +1,408 @@ | |||
var LIB_VERSION_GLOBAL = '3.0.2'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not const?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
modules/improvedigitalBidAdapter.js
Outdated
var adaptermanager = require('src/adaptermanager'); | ||
|
||
const ImproveDigitalAdapter = function () { | ||
var IMPROVE_DIGITAL_BIDDER_CODE = 'improvedigital'; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
modules/improvedigitalBidAdapter.js
Outdated
singleRequestMode: false, | ||
httpRequestType: this.idClient.CONSTANTS.HTTP_REQUEST_TYPE.GET, | ||
callback: CALLBACK_FUNCTION, | ||
secure: (loc.protocol === 'https:') ? 1 : 0, |
There was a problem hiding this comment.
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
?
modules/improvedigitalBidAdapter.js
Outdated
); | ||
|
||
if (request.errors && request.errors.length > 0) { | ||
console.log('ID WARNING 0x01'); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
modules/improvedigitalBidAdapter.js
Outdated
|
||
var baseUrl = (requestParameters.secure === 1 ? 'https' : 'http') + '://' + this.CONSTANTS.AD_SERVER_BASE_URL + '/'; | ||
|
||
var bidRequestObject; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
All concerns have been addressed and automated checks are passing. Please approve the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi, I don't see the approval. Merge is still blocked. Can you please take a look? Cheers. |
@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. |
@agregorio-improve |
All comments have been addressed. Please approve this merge request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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? |
Thank you @muuki88 and @jaiminpanchal27 but it looks like @harpere is still blocking this. Anything you can do? |
Hi, Can someone unblock this please? Regards, |
Hi all, |
There was a problem hiding this 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.
modules/improvedigitalBidAdapter.js
Outdated
const LIB_VERSION_GLOBAL = '3.0.5'; | ||
|
||
var CONSTANTS = require('src/constants'); | ||
var utils = require('src/utils'); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
modules/improvedigitalBidAdapter.js
Outdated
let LIB_VERSION = LIB_VERSION_GLOBAL; | ||
|
||
// Ad server needs to implement JSONP using this function as the callback | ||
let CALLBACK_FUNCTION = '$$PREBID_GLOBAL$$' + '.improveDigitalResponse'; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
modules/improvedigitalBidAdapter.js
Outdated
if (bidObject.id === bidRequest.bidId) { | ||
let bid; | ||
if (!bidObject.price || bidObject.price === null) { | ||
bid = bidfactory.createBid(CONSTANTS.STATUS.NO_BID, bidRequest); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
modules/improvedigitalBidAdapter.js
Outdated
|
||
let nurl = ''; | ||
if (bidObject.nurl && bidObject.nurl.length > 0) { | ||
nurl = '<img src=\"' + bidObject.nurl + '\" width=\"0\" height=\"0\" style=\"display:none\">'; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@agregorio-improve @Re-lM |
…templates instead of string concatenation
All outstanding issues have been addressed. Please provide feedback and/or approve merge. |
modules/improvedigitalBidAdapter.js
Outdated
let syncInd = syncElement.replace(/\//g, '\\\/'); | ||
syncString += '<img src=\\\"' + syncInd + '\\\"\/>'; | ||
syncString = `${syncString}${(syncString === '') ? 'document.writeln(\"' : ''}<img src=\\\"${syncInd}\\\" style=\\\"display:none\\\"\/>`; |
There was a problem hiding this comment.
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
* 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
* 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
* 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) ...
* 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
….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) ...
* 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
Type of change
Description of change
Be sure to test the integration with your adserver using the Hello World sample page.
Other information