Skip to content

Commit

Permalink
AcuityAds Bid Adapter: add gpp support (#10544)
Browse files Browse the repository at this point in the history
* add prebid.js adapter

* changes

* changes

* changes

* changes

* fix downolad

* add gpp
  • Loading branch information
AcuityAdsIntegrations authored Sep 28, 2023
1 parent 24fc39d commit 702bbbe
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
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

0 comments on commit 702bbbe

Please sign in to comment.