Skip to content

Commit

Permalink
GumGum Bid Adapter: Send ae parameter in the request (prebid#11913)
Browse files Browse the repository at this point in the history
* Send ae parameter in the request.

* Fix comments for jsdoc warrnings
  • Loading branch information
MartinGumGum authored and mefjush committed Jul 19, 2024
1 parent 5305b22 commit 8176909
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
24 changes: 14 additions & 10 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 = [];
Expand All @@ -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';
Expand Down Expand Up @@ -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;
}
Expand Down
17 changes: 17 additions & 0 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 8176909

Please sign in to comment.