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

yahoospp bidder& aol bidder: GPP Support in bid requests #9345

Merged
merged 6 commits into from
Jan 8, 2023
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
12 changes: 12 additions & 0 deletions modules/aolBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ export const spec = {
if (bidderRequest) {
consentData.gdpr = bidderRequest.gdprConsent;
consentData.uspConsent = bidderRequest.uspConsent;
consentData.gppConsent = bidderRequest.gppConsent;
if (!consentData.gppConsent && bidderRequest.ortb2?.regs?.gpp) {
consentData.gppConsent = {
gppString: bidderRequest.ortb2.regs.gpp,
applicableSections: bidderRequest.ortb2.regs.gpp_sid
}
}
}

return bids.map(bid => {
Expand Down Expand Up @@ -373,6 +380,11 @@ export const spec = {
params.us_privacy = consentData.uspConsent;
}

if (consentData.gppConsent && consentData.gppConsent.gppString) {
patmmccann marked this conversation as resolved.
Show resolved Hide resolved
params.gpp = consentData.gppConsent.gppString;
params.gpp_sid = consentData.gppConsent.applicableSections;
}

return params;
},
parsePixelItems(pixels) {
Expand Down
5 changes: 5 additions & 0 deletions modules/yahoosspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ function generateOpenRtbObject(bidderRequest, bid) {
outBoundBidRequest.site.id = bid.params.dcn;
};

if (bidderRequest.ortb2?.regs?.gpp) {
outBoundBidRequest.regs.ext.gpp = bidderRequest.ortb2.regs.gpp;
outBoundBidRequest.regs.ext.gpp_sid = bidderRequest.ortb2.regs.gpp_sid
};

if (bidderRequest.ortb2) {
outBoundBidRequest = appendFirstPartyData(outBoundBidRequest, bid);
};
Expand Down
22 changes: 22 additions & 0 deletions test/spec/modules/aolBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,20 @@ describe('AolAdapter', function () {
expect(request.url).to.contain(NEXAGE_URL + 'dcn=2c9d2b50015c5ce9db6aeeed8b9500d6&pos=header');
});

it('should return One Mobile url with configured GPP data', function () {
let bidRequest = createCustomBidRequest({
params: getNexageGetBidParams()
});
bidRequest.ortb2 = {
regs: {
gpp: 'testgpp',
gpp_sid: [8]
}
}
let [request] = spec.buildRequests(bidRequest.bids, bidRequest);
expect(request.url).to.contain('gpp=testgpp&gpp_sid=8');
});

it('should return One Mobile url with cmd=bid option', function () {
let bidRequest = createCustomBidRequest({
params: getNexageGetBidParams()
Expand Down Expand Up @@ -794,6 +808,14 @@ describe('AolAdapter', function () {
'euconsent=test-consent;gdpr=1;us_privacy=test-usp-consent;');
});

it('should return formatted gpp privacy params when formatConsentData returns GPP data', function () {
formatConsentDataStub.returns({
gpp: 'gppstring',
gpp_sid: [6, 7]
});
expect(spec.formatMarketplaceDynamicParams()).to.be.equal('gpp=gppstring;gpp_sid=6%2C7;');
});

it('should return formatted params when formatKeyValues returns data', function () {
formatKeyValuesStub.returns({
param1: 'val1',
Expand Down
17 changes: 16 additions & 1 deletion test/spec/modules/yahoosspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { config } from 'src/config.js';
import { BANNER, VIDEO } from 'src/mediaTypes.js';
import { spec } from 'modules/yahoosspBidAdapter.js';
import {createEidsArray} from '../../../modules/userId/eids';
import {deepClone} from '../../../src/utils';

const DEFAULT_BID_ID = '84ab500420319d';
const DEFAULT_BID_DCN = '2093845709823475';
Expand Down Expand Up @@ -713,7 +714,7 @@ describe('YahooSSP Bid Adapter:', () => {
});
});

describe('GDPR & Consent:', () => {
describe('GDPR & Consent & GPP:', () => {
it('should return request objects that do not send cookies if purpose 1 consent is not provided', () => {
const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
bidderRequest.gdprConsent = {
Expand All @@ -731,6 +732,20 @@ describe('YahooSSP Bid Adapter:', () => {
const options = spec.buildRequests(validBidRequests, bidderRequest)[0].options;
expect(options.withCredentials).to.be.false;
});

it('adds the ortb2 gpp consent info to the request', function () {
const { validBidRequests, bidderRequest } = generateBuildRequestMock({});
const ortb2 = {
regs: {
gpp: 'somegppstring',
gpp_sid: [6, 7]
}
};
let clonedBidderRequest = {...bidderRequest, ortb2};
const data = spec.buildRequests(validBidRequests, clonedBidderRequest)[0].data;
expect(data.regs.ext.gpp).to.equal('somegppstring');
expect(data.regs.ext.gpp_sid).to.eql([6, 7]);
});
});

describe('Endpoint & Impression Request Mode:', () => {
Expand Down