Skip to content

Commit

Permalink
Pubmatic Bid Adapter: Removed logic to append JW player data to the "…
Browse files Browse the repository at this point in the history
…dctr" param (prebid#9169)

* removed logic to append jw data to dctr param

* removed unneeded code

* removed extra html page for testing
  • Loading branch information
jlquaccia authored and jorgeluisrocha committed May 18, 2023
1 parent 1a0b87a commit 0d5971f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 186 deletions.
11 changes: 3 additions & 8 deletions modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ function _addDealCustomTargetings(imp, bid) {
}
}

function _addJWPlayerSegmentData(imp, bid, isS2S) {
function _addJWPlayerSegmentData(imp, bid) {
var jwSegData = (bid.rtd && bid.rtd.jwplayer && bid.rtd.jwplayer.targeting) || undefined;
var jwPlayerData = '';
const jwMark = 'jw-';
Expand All @@ -620,12 +620,8 @@ function _addJWPlayerSegmentData(imp, bid, isS2S) {

var ext;

if (isS2S) {
(imp.dctr === undefined || imp.dctr.length == 0) ? imp.dctr = jwPlayerData : imp.dctr += '|' + jwPlayerData;
} else {
ext = imp.ext;
ext && ext.key_val === undefined ? ext.key_val = jwPlayerData : ext.key_val += '|' + jwPlayerData;
}
ext = imp.ext;
ext && ext.key_val === undefined ? ext.key_val = jwPlayerData : ext.key_val += '|' + jwPlayerData;
}

function _createImpressionObject(bid, conf) {
Expand Down Expand Up @@ -1371,7 +1367,6 @@ export const spec = {
*/

transformBidParams: function (params, isOpenRtb, adUnit, bidRequests) {
_addJWPlayerSegmentData(params, adUnit.bids[0], true);
return convertTypes({
'publisherId': 'string',
'adSlot': 'string'
Expand Down
178 changes: 0 additions & 178 deletions test/spec/modules/pubmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3816,184 +3816,6 @@ describe('PubMatic adapter', function () {
});
});

describe('JW player segment data for S2S', function() {
let sandbox = sinon.sandbox.create();
beforeEach(function () {
sandbox = sinon.sandbox.create();
});
afterEach(function() {
sandbox.restore();
});
it('Should append JW player segment data to dctr values in auction endpoint', function() {
var videoAdUnit = {
'bidderCode': 'pubmatic',
'bids': [
{
'bidder': 'pubmatic',
'params': {
'publisherId': '156276',
'adSlot': 'pubmatic_video2',
'dctr': 'key1=123|key2=345',
'pmzoneid': '1243',
'video': {
'mimes': ['video/mp4', 'video/x-flv'],
'skippable': true,
'minduration': 5,
'maxduration': 30,
'startdelay': 5,
'playbackmethod': [1, 3],
'api': [1, 2],
'protocols': [2, 3],
'battr': [13, 14],
'linearity': 1,
'placement': 2,
'minbitrate': 10,
'maxbitrate': 10
}
},
'rtd': {
'jwplayer': {
'targeting': {
'segments': ['80011026', '80011035'],
'content': {
'id': 'jw_d9J2zcaA'
}
}
}
},
'bid_id': '17a6771be26cc4',
'ortb2Imp': {
'ext': {
'data': {
'pbadslot': 'abcd',
'jwTargeting': {
'playerID': 'myElement1',
'mediaID': 'd9J2zcaA'
}
}
}
}
}
],
'auctionStart': 1630923178417,
'timeout': 1000,
'src': 's2s'
}

spec.transformBidParams(bidRequests[0].params, true, videoAdUnit);
expect(bidRequests[0].params.dctr).to.equal('key1:val1,val2|key2:val1|jw-id=jw_d9J2zcaA|jw-80011026=1|jw-80011035=1');
});
it('Should send only JW player segment data in auction endpoint, if dctr is missing', function() {
var videoAdUnit = {
'bidderCode': 'pubmatic',
'bids': [
{
'bidder': 'pubmatic',
'params': {
'publisherId': '156276',
'adSlot': 'pubmatic_video2',
'dctr': 'key1=123|key2=345',
'pmzoneid': '1243',
'video': {
'mimes': ['video/mp4', 'video/x-flv'],
'skippable': true,
'minduration': 5,
'maxduration': 30,
'startdelay': 5,
'playbackmethod': [1, 3],
'api': [1, 2],
'protocols': [2, 3],
'battr': [13, 14],
'linearity': 1,
'placement': 2,
'minbitrate': 10,
'maxbitrate': 10
}
},
'rtd': {
'jwplayer': {
'targeting': {
'segments': ['80011026', '80011035'],
'content': {
'id': 'jw_d9J2zcaA'
}
}
}
},
'bid_id': '17a6771be26cc4',
'ortb2Imp': {
'ext': {
'data': {
'pbadslot': 'abcd',
'jwTargeting': {
'playerID': 'myElement1',
'mediaID': 'd9J2zcaA'
}
}
}
}
}
],
'auctionStart': 1630923178417,
'timeout': 1000,
'src': 's2s'
}

delete bidRequests[0].params.dctr;
spec.transformBidParams(bidRequests[0].params, true, videoAdUnit);
expect(bidRequests[0].params.dctr).to.equal('jw-id=jw_d9J2zcaA|jw-80011026=1|jw-80011035=1');
});

it('Should not send any JW player segment data in auction endpoint, if it is not available', function() {
var videoAdUnit = {
'bidderCode': 'pubmatic',
'bids': [
{
'bidder': 'pubmatic',
'params': {
'publisherId': '156276',
'adSlot': 'pubmatic_video2',
'dctr': 'key1=123|key2=345',
'pmzoneid': '1243',
'video': {
'mimes': ['video/mp4', 'video/x-flv'],
'skippable': true,
'minduration': 5,
'maxduration': 30,
'startdelay': 5,
'playbackmethod': [1, 3],
'api': [1, 2],
'protocols': [2, 3],
'battr': [13, 14],
'linearity': 1,
'placement': 2,
'minbitrate': 10,
'maxbitrate': 10
}
},
'bid_id': '17a6771be26cc4',
'ortb2Imp': {
'ext': {
'data': {
'pbadslot': 'abcd',
'jwTargeting': {
'playerID': 'myElement1',
'mediaID': 'd9J2zcaA'
}
}
}
}
}
],
'auctionStart': 1630923178417,
'timeout': 1000,
'src': 's2s'
}
spec.transformBidParams(bidRequests[0].params, true, videoAdUnit);
expect(bidRequests[0].params.dctr).to.equal('key1:val1,val2|key2:val1');
});
})

describe('Checking for Video.Placement property', function() {
let sandbox, utilsMock;
const adUnit = 'Div1';
Expand Down

0 comments on commit 0d5971f

Please sign in to comment.