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

Yieldmo Bid Adapter: adding Prebid 9 compatibility #11507

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function hasVideoMediaType(bidRequest) {
* @param request bid request
*/
function addPlacement(request) {
const gpid = deepAccess(request, 'ortb2Imp.ext.data.pbadslot');
const gpid = deepAccess(request, 'ortb2Imp.ext.gpid') || deepAccess(request, 'ortb2Imp.ext.data.pbadslot');
const placementInfo = {
placement_id: request.adUnitCode,
callback_id: request.bidId,
Expand Down Expand Up @@ -337,8 +337,7 @@ function createNewVideoBid(response, bidRequest) {
mediaType: VIDEO,
},
};

if (imp.video.placement && imp.video.placement !== 1) {
if (imp.video.plcmt && imp.video.plcmt !== 1) {
const renderer = Renderer.install({
url: OUTSTREAM_VIDEO_PLAYER_URL,
config: {
Expand All @@ -349,7 +348,7 @@ function createNewVideoBid(response, bidRequest) {
allowVpaid: true,
autoPlay: true,
preload: true,
mute: true
mute: true,
},
id: imp.tagid,
loaded: false,
Expand Down Expand Up @@ -471,7 +470,7 @@ function getTopics(bidderRequest) {
* @return Object OpenRTB's 'imp' (impression) object
*/
function openRtbImpression(bidRequest) {
const gpid = deepAccess(bidRequest, 'ortb2Imp.ext.data.pbadslot');
const gpid = deepAccess(bidRequest, 'ortb2Imp.ext.gpid') || deepAccess(bidRequest, 'ortb2Imp.ext.data.pbadslot');
const size = extractPlayerSize(bidRequest);
const imp = {
id: bidRequest.bidId,
Expand Down Expand Up @@ -653,15 +652,6 @@ function validateVideoParams(bid) {
validate('video.mimes', val => isDefined(val), paramRequired);
validate('video.mimes', val => isArray(val) && val.every(v => isStr(v)), paramInvalid,
'array of strings, ex: ["video/mp4"]');

const placement = validate('video.placement', val => isDefined(val), paramRequired);
validate('video.placement', val => val >= 1 && val <= 5, paramInvalid);
if (placement === 1) {
validate('video.startdelay', val => isDefined(val),
(field, v) => paramRequired(field, v, 'placement == 1'));
validate('video.startdelay', val => isNumber(val), paramInvalid, 'number, ex: 5');
}

validate('video.protocols', val => isDefined(val), paramRequired);

validate('video.api', val => isDefined(val), paramRequired);
Expand Down
3 changes: 0 additions & 3 deletions test/spec/modules/yieldmoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ describe('YieldmoAdapter', function () {

it('should return false when required bid.params.video.* is not found', function () {
const getBidAndExclude = paramToRemove => getVideoBidWithoutParam('params.video', paramToRemove);

expect(spec.isBidRequestValid(getBidAndExclude('placement'))).to.be.false;
expect(spec.isBidRequestValid(getBidAndExclude('maxduration'))).to.be.false;
expect(spec.isBidRequestValid(getBidAndExclude('startdelay'))).to.be.false;
expect(spec.isBidRequestValid(getBidAndExclude('protocols'))).to.be.false;
expect(spec.isBidRequestValid(getBidAndExclude('api'))).to.be.false;
});
Expand Down