Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GumGum Bid Adapter: Send ae parameter in the request #11913

Merged
Show file tree
Hide file tree
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
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
MartinGumGum marked this conversation as resolved.
Show resolved Hide resolved
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