From 702bbbec675baebda1fe355cdcefe2ebe5d95739 Mon Sep 17 00:00:00 2001 From: AcuityAdsIntegrations <72594990+AcuityAdsIntegrations@users.noreply.github.com> Date: Thu, 28 Sep 2023 15:33:37 +0300 Subject: [PATCH] AcuityAds Bid Adapter: add gpp support (#10544) * add prebid.js adapter * changes * changes * changes * changes * fix downolad * add gpp --- ...dsBidAdapter.js => acuityadsBidAdapter.js} | 9 +++++ ...dsBidAdapter.md => acuityadsBidAdapter.md} | 2 +- ...er_spec.js => acuityadsBidAdapter_spec.js} | 33 +++++++++++++++++-- 3 files changed, 41 insertions(+), 3 deletions(-) rename modules/{acuityAdsBidAdapter.js => acuityadsBidAdapter.js} (94%) rename modules/{acuityAdsBidAdapter.md => acuityadsBidAdapter.md} (98%) rename test/spec/modules/{acuityAdsBidAdapter_spec.js => acuityadsBidAdapter_spec.js} (92%) diff --git a/modules/acuityAdsBidAdapter.js b/modules/acuityadsBidAdapter.js similarity index 94% rename from modules/acuityAdsBidAdapter.js rename to modules/acuityadsBidAdapter.js index b0bb132ddae..5b12eb2133b 100644 --- a/modules/acuityAdsBidAdapter.js +++ b/modules/acuityadsBidAdapter.js @@ -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]; diff --git a/modules/acuityAdsBidAdapter.md b/modules/acuityadsBidAdapter.md similarity index 98% rename from modules/acuityAdsBidAdapter.md rename to modules/acuityadsBidAdapter.md index a19e0a6b0ba..7f001cd9376 100644 --- a/modules/acuityAdsBidAdapter.md +++ b/modules/acuityadsBidAdapter.md @@ -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 diff --git a/test/spec/modules/acuityAdsBidAdapter_spec.js b/test/spec/modules/acuityadsBidAdapter_spec.js similarity index 92% rename from test/spec/modules/acuityAdsBidAdapter_spec.js rename to test/spec/modules/acuityadsBidAdapter_spec.js index 05c59036ff3..31ef9dd6466 100644 --- a/test/spec/modules/acuityAdsBidAdapter_spec.js +++ b/test/spec/modules/acuityadsBidAdapter_spec.js @@ -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'; @@ -77,7 +77,8 @@ describe('AcuityAdsBidAdapter', function () { refererInfo: { referer: 'https://test.com' }, - timeout: 500 + timeout: 500, + ortb2: {} }; describe('isBidRequestValid', function () { @@ -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;