From a709919284b59f56e1a151a2dafdd4dfe0aee2b5 Mon Sep 17 00:00:00 2001 From: robertrmartinez Date: Wed, 23 Mar 2022 17:54:14 -0700 Subject: [PATCH] Rubicon Analytics, pass along gpid --- modules/rubiconAnalyticsAdapter.js | 4 ++- .../modules/rubiconAnalyticsAdapter_spec.js | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/modules/rubiconAnalyticsAdapter.js b/modules/rubiconAnalyticsAdapter.js index 55877a43d38..34e4a04aac2 100644 --- a/modules/rubiconAnalyticsAdapter.js +++ b/modules/rubiconAnalyticsAdapter.js @@ -232,6 +232,7 @@ function sendMessage(auctionId, bidWonId, trigger) { 'adserverTargeting', () => !isEmpty(cache.targeting[bid.adUnit.adUnitCode]) ? stringProperties(cache.targeting[bid.adUnit.adUnitCode]) : undefined, 'gam', gam => !isEmpty(gam) ? gam : undefined, 'pbAdSlot', + 'gpid', 'pattern' ]); adUnit.bids = []; @@ -770,7 +771,8 @@ let rubiconAdapter = Object.assign({}, baseAdapter, { } }, 'pbAdSlot', () => deepAccess(bid, 'ortb2Imp.ext.data.pbadslot'), - 'pattern', () => deepAccess(bid, 'ortb2Imp.ext.data.aupname') + 'pattern', () => deepAccess(bid, 'ortb2Imp.ext.data.aupname'), + 'gpid', () => deepAccess(bid, 'ortb2Imp.ext.gpid') ]) ]); return memo; diff --git a/test/spec/modules/rubiconAnalyticsAdapter_spec.js b/test/spec/modules/rubiconAnalyticsAdapter_spec.js index 397388c8237..354fbb53027 100644 --- a/test/spec/modules/rubiconAnalyticsAdapter_spec.js +++ b/test/spec/modules/rubiconAnalyticsAdapter_spec.js @@ -2098,6 +2098,35 @@ describe('rubicon analytics adapter', function () { expect(message.auctions[0].adUnits[1].pattern).to.equal('1234/mycoolsite/*&gpt_skyscraper&deviceType=mobile'); }); + it('should pass gpid if defined', function () { + let bidRequest = utils.deepClone(MOCK.BID_REQUESTED); + bidRequest.bids[0].ortb2Imp = { + ext: { + gpid: '1234/mycoolsite/lowerbox' + } + }; + bidRequest.bids[1].ortb2Imp = { + ext: { + gpid: '1234/mycoolsite/leaderboard' + } + }; + events.emit(AUCTION_INIT, MOCK.AUCTION_INIT); + events.emit(BID_REQUESTED, bidRequest); + events.emit(BID_RESPONSE, MOCK.BID_RESPONSE[0]); + events.emit(BIDDER_DONE, MOCK.BIDDER_DONE); + events.emit(AUCTION_END, MOCK.AUCTION_END); + events.emit(SET_TARGETING, MOCK.SET_TARGETING); + + clock.tick(SEND_TIMEOUT + 1000); + + expect(server.requests.length).to.equal(1); + + let message = JSON.parse(server.requests[0].requestBody); + validate(message); + expect(message.auctions[0].adUnits[0].gpid).to.equal('1234/mycoolsite/lowerbox'); + expect(message.auctions[0].adUnits[1].gpid).to.equal('1234/mycoolsite/leaderboard'); + }); + it('should pass bidderDetail for multibid auctions', function () { let bidResponse = utils.deepClone(MOCK.BID_RESPONSE[1]); bidResponse.targetingBidder = 'rubi2';