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

AcuityAds Bid Adapter: add gpp support #10544

Merged
merged 10 commits into from
Sep 28, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ export const spec = {
tmax: bidderRequest.timeout
};

// Add GPP consent
if (bidderRequest.gppConsent) {
request.gpp = bidderRequest.gppConsent.gppString;
request.gpp_sid = bidderRequest.gppConsent.applicableSections;
} else if (bidderRequest.ortb2?.regs?.gpp) {
request.gpp = bidderRequest.ortb2.regs.gpp;
request.gpp_sid = bidderRequest.ortb2.regs.gpp_sid;
}

const len = validBidRequests.length;
for (let i = 0; i < len; i++) {
const bid = validBidRequests[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```
Module Name: AcuityAds Bidder Adapter
Module Type: AcuityAds Bidder Adapter
Maintainer: sa-support@brightcom.com
Maintainer: rafi.babler@acuityads.com
```

# Description
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { spec } from '../../../modules/acuityAdsBidAdapter';
import { spec } from '../../../modules/acuityadsBidAdapter';
import { BANNER, VIDEO, NATIVE } from '../../../src/mediaTypes.js';
import { getUniqueIdentifierStr } from '../../../src/utils.js';

Expand Down Expand Up @@ -77,7 +77,8 @@ describe('AcuityAdsBidAdapter', function () {
refererInfo: {
referer: 'https://test.com'
},
timeout: 500
timeout: 500,
ortb2: {}
};

describe('isBidRequestValid', function () {
Expand Down Expand Up @@ -187,6 +188,34 @@ describe('AcuityAdsBidAdapter', function () {
expect(data.gdpr).to.not.exist;
});

describe('Returns data with gppConsent', function () {
it('bidderRequest.gppConsent', () => {
bidderRequest.gppConsent = {
gppString: 'abc123',
applicableSections: [8]
};

serverRequest = spec.buildRequests(bids, bidderRequest);
let data = serverRequest.data;
expect(data).to.be.an('object');
expect(data).to.have.property('gpp');
expect(data).to.have.property('gpp_sid');
delete bidderRequest.gppConsent;
})

it('bidderRequest.ortb2.regs.gpp', () => {
bidderRequest.ortb2.regs = bidderRequest.ortb2.regs || {};
bidderRequest.ortb2.regs.gpp = 'abc123';
bidderRequest.ortb2.regs.gpp_sid = [8];

serverRequest = spec.buildRequests(bids, bidderRequest);
let data = serverRequest.data;
expect(data).to.be.an('object');
expect(data).to.have.property('gpp');
expect(data).to.have.property('gpp_sid');
})
});

it('Returns empty data if no valid requests are passed', function () {
serverRequest = spec.buildRequests([], bidderRequest);
let data = serverRequest.data;
Expand Down