From 971e8f04299ab42c18ff7f3d446b85fea877adbc Mon Sep 17 00:00:00 2001 From: furukawaTakumi <45890154+furukawaTakumi@users.noreply.github.com> Date: Thu, 27 Feb 2025 23:12:37 +0900 Subject: [PATCH] Ssp_geniee Bid Adapter : add support for GPID and pbadslot (#12806) * modify adUnit infomation * fix imuid module * feat(GenieeBidAdapter): Add support for GPID and pbadslot - Add support for GPID (Global Placement ID) from ortb2Imp.ext.gpid - Add fallback support for ortb2Imp.ext.data.pbadslot - Include gpid parameter in request when GPID exists - Add test cases to verify GPID, pbadslot, and priority behavior --------- Co-authored-by: Murano Takamasa Co-authored-by: daikichiteranishi <49385718+daikichiteranishi@users.noreply.github.com> Co-authored-by: teranishi daikichi Co-authored-by: gn-daikichi <49385718+gn-daikichi@users.noreply.github.com> Co-authored-by: takumi-furukawa --- modules/ssp_genieeBidAdapter.js | 3 ++ .../spec/modules/ssp_genieeBidAdapter_spec.js | 53 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/modules/ssp_genieeBidAdapter.js b/modules/ssp_genieeBidAdapter.js index ed15842f96b..8be3c0c58af 100644 --- a/modules/ssp_genieeBidAdapter.js +++ b/modules/ssp_genieeBidAdapter.js @@ -129,6 +129,8 @@ function hasParamsNotBlankString(params, key) { * @see https://docs.prebid.org/dev-docs/bidder-adaptor.html#location-and-referrers */ function makeCommonRequestData(bid, geparameter, refererInfo) { + const gpid = utils.deepAccess(bid, 'ortb2Imp.ext.gpid') || utils.deepAccess(bid, 'ortb2Imp.ext.data.pbadslot'); + const data = { zoneid: bid.params.zoneId, cb: Math.floor(Math.random() * 99999999999), @@ -145,6 +147,7 @@ function makeCommonRequestData(bid, geparameter, refererInfo) { tpaf: 1, cks: 1, ib: 0, + ...(gpid ? { gpid } : {}), }; try { diff --git a/test/spec/modules/ssp_genieeBidAdapter_spec.js b/test/spec/modules/ssp_genieeBidAdapter_spec.js index dbf8ded5199..5dd3688561f 100644 --- a/test/spec/modules/ssp_genieeBidAdapter_spec.js +++ b/test/spec/modules/ssp_genieeBidAdapter_spec.js @@ -357,6 +357,59 @@ describe('ssp_genieeBidAdapter', function () { const request = spec.buildRequests([{...BANNER_BID, userId: {imuid}}]); expect(request[0].data.extuid).to.deep.equal(`im:${imuid}`); }); + + it('should include gpid when ortb2Imp.ext.gpid exists', function () { + const gpid = '/123/abc'; + const bidWithGpid = { + ...BANNER_BID, + ortb2Imp: { + ext: { + gpid: gpid + } + } + }; + const request = spec.buildRequests([bidWithGpid]); + expect(String(request[0].data.gpid)).to.have.string(gpid); + }); + + it('should include gpid when ortb2Imp.ext.data.pbadslot exists', function () { + const pbadslot = '/123/abc'; + const bidWithPbadslot = { + ...BANNER_BID, + ortb2Imp: { + ext: { + data: { + pbadslot: pbadslot + } + } + } + }; + const request = spec.buildRequests([bidWithPbadslot]); + expect(String(request[0].data.gpid)).to.have.string(pbadslot); + }); + + it('should prioritize ortb2Imp.ext.gpid over ortb2Imp.ext.data.pbadslot', function () { + const gpid = '/123/abc'; + const pbadslot = '/456/def'; + const bidWithBoth = { + ...BANNER_BID, + ortb2Imp: { + ext: { + gpid: gpid, + data: { + pbadslot: pbadslot + } + } + } + }; + const request = spec.buildRequests([bidWithBoth]); + expect(String(request[0].data.gpid)).to.have.string(gpid); + }); + + it('should not include gpid when neither ortb2Imp.ext.gpid nor ortb2Imp.ext.data.pbadslot exists', function () { + const request = spec.buildRequests([BANNER_BID]); + expect(request[0].data).to.not.have.property('gpid'); + }); }); });