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

Pubmatic Bid Adapter: Removed logic to append JW player data to the "dctr" param #9169

Merged
merged 3 commits into from
Feb 23, 2023
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
11 changes: 3 additions & 8 deletions modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,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 @@ -624,12 +624,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 @@ -3808,184 +3808,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