From 082ee5fcd3712b62e55dfef02b129775a6560520 Mon Sep 17 00:00:00 2001 From: MartinGumGum <109325501+MartinGumGum@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:35:56 -0700 Subject: [PATCH] GumGum Bid Adapter: Send ae parameter in the request (#11913) * Send ae parameter in the request. * Fix comments for jsdoc warrnings --- modules/gumgumBidAdapter.js | 24 +++++++++++++--------- test/spec/modules/gumgumBidAdapter_spec.js | 17 +++++++++++++++ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/modules/gumgumBidAdapter.js b/modules/gumgumBidAdapter.js index 774b4b2f6f7..ecab3d0b970 100644 --- a/modules/gumgumBidAdapter.js +++ b/modules/gumgumBidAdapter.js @@ -215,11 +215,12 @@ function _getVidParams(attributes) { } /** - * Gets bidfloor - * @param {Object} mediaTypes - * @param {Number} bidfloor - * @param {Object} bid - * @returns {Number} floor + * Retrieves the bid floor value, which is the minimum acceptable bid for an ad unit. + * This function calculates the bid floor based on the given media types and other bidding parameters. + * @param {Object} mediaTypes - The media types specified for the bid, which might influence floor calculations. + * @param {number} staticBidFloor - The default or static bid floor set for the bid. + * @param {Object} bid - The bid object which may contain a method to get dynamic floor values. + * @returns {Object} An object containing the calculated bid floor and its currency. */ function _getFloor(mediaTypes, staticBidFloor, bid) { const curMediaType = Object.keys(mediaTypes)[0] || 'banner'; @@ -290,10 +291,10 @@ function getEids(userId) { } /** - * Make a server request from the list of BidRequests. - * - * @param {validBidRequests[]} - an array of bids - * @return ServerRequest Info describing the request to the server. + * Builds requests for bids. + * @param {validBidRequests[]} validBidRequests - An array of valid bid requests. + * @param {Object} bidderRequest - The bidder's request information. + * @returns {Object[]} An array of server requests. */ function buildRequests(validBidRequests, bidderRequest) { const bids = []; @@ -316,6 +317,7 @@ function buildRequests(validBidRequests, bidderRequest) { const { currency, floor } = _getFloor(mediaTypes, params.bidfloor, bidRequest); const eids = getEids(userId); const gpid = deepAccess(ortb2Imp, 'ext.gpid') || deepAccess(ortb2Imp, 'ext.data.pbadslot'); + const paapiEligible = deepAccess(ortb2Imp, 'ext.ae') === 1 let sizes = [1, 1]; let data = {}; data.displaymanager = 'Prebid.js - gumgum'; @@ -402,7 +404,9 @@ function buildRequests(validBidRequests, bidderRequest) { } else { // legacy params data = { ...data, ...handleLegacyParams(params, sizes) }; } - + if (paapiEligible) { + data.ae = paapiEligible + } if (gdprConsent) { data.gdprApplies = gdprConsent.gdprApplies ? 1 : 0; } diff --git a/test/spec/modules/gumgumBidAdapter_spec.js b/test/spec/modules/gumgumBidAdapter_spec.js index 3424d172775..e6fa6d468ca 100644 --- a/test/spec/modules/gumgumBidAdapter_spec.js +++ b/test/spec/modules/gumgumBidAdapter_spec.js @@ -321,6 +321,23 @@ describe('gumgumAdapter', function () { expect(bidRequest.data).to.have.property('gpid'); expect(bidRequest.data.gpid).to.equal('/17037559/jeusol/jeusol_D_1'); }); + it('should set ae value to 1 for PAAPI', function () { + const req = { ...bidRequests[0], + ortb2Imp: { + ext: { + ae: 1, + data: { + adserver: { + name: 'test', + adslot: 123456 + } + } + } + } } + const bidRequest = spec.buildRequests([req])[0]; + expect(bidRequest.data).to.have.property('ae'); + expect(bidRequest.data.ae).to.equal(true); + }); it('should set the global placement id (gpid) if in pbadslot property', function () { const pbadslot = 'abc123'