Skip to content
Closed
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: 10 additions & 1 deletion modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ const converter = ortbConverter({
},
imp(buildImp, bidRequest, context) {
const { kadfloor, currency, adSlot = '', deals, dctr, pmzoneid, hashedKey } = bidRequest.params;
const { adUnitCode, mediaTypes, rtd } = bidRequest;
const { adUnitCode, mediaTypes, rtd, ortb2 } = bidRequest;
const imp = buildImp(bidRequest, context);
const imSegments = deepAccess(ortb2, 'user.ext.data.im_segments');
if (deals) addPMPDeals(imp, deals);
if (dctr) addDealCustomTargetings(imp, dctr);
if (imSegments) addImSegmentData(imp, imSegments);
if (rtd?.jwplayer) addJWPlayerSegmentData(imp, rtd.jwplayer);
imp.bidfloor = _parseSlotParam('kadfloor', kadfloor);
imp.bidfloorcur = currency ? _parseSlotParam('currency', currency) : DEFAULT_CURRENCY;
Expand Down Expand Up @@ -353,6 +355,13 @@ const updateVideoImp = (videoImp, videoParams, adUnitCode, imp) => {
}
}

const addImSegmentData = (imp, imSegments) => {
if (!imSegments || !isArray(imSegments) || imSegments.length === 0) return;
const imSegData = `im_segments=${imSegments.join(',')}`;
imp.ext = imp.ext || {};
imp.ext.key_val = imp.ext.key_val ? `${imp.ext.key_val}|${imSegData}` : imSegData;
};

const addJWPlayerSegmentData = (imp, jwplayer) => {
const jwSegData = jwplayer?.targeting;
if (!jwSegData || !jwSegData.segments?.length) return;
Expand Down
Loading