From 4bc0f9b3b0e7efdd365b5c8d905e09961bfd6dbf Mon Sep 17 00:00:00 2001 From: Pupis Date: Fri, 27 Apr 2018 16:39:43 +0300 Subject: [PATCH] GDPR support in adform adapter (#2396) * bid response adId same as bidId * test * update adform bid adapter * update unit tests * Added adform adapter description file * updated tests * Another tests update * Add auctionId * Update adapter for auctionId * add auctionId to adformBidAdapter * Final updates to fit 1.0 version * update docs and integration example * Do not mutate original validBidRequests * use atob and btoa instead of custom made module * Renaming one query string parameter * XDomainRequest.send exception fix (#1942) * Added YIELDONE Bid Adapter for Prebid.js 1.0 (#1900) * Added YIELDONE Bid Adapter for Prebid.js 1.0 * Update yieldoneBidAdapter.md change placementId to 44082 * Changed to get size from bid.sizes * fix sizes array * Add user-facing docs reminder to PR template (#1956) * allow non-mappable sizes to be passed and used in rubicon adapter (#1893) * Typo correction of YIELDONE md file (#1954) * Added YIELDONE Bid Adapter for Prebid.js 1.0 * Update yieldoneBidAdapter.md change placementId to 44082 * Changed to get size from bid.sizes * fix sizes array * Fix a typo * Serverbid bid adapter: update alias config (#1963) * use auctionId instead of requestId (#1968) * Add freewheel ssp bidder adapter for prebid 1.0 (#1793) * add stickyadsTV bidder adapter * init unit test file * ad some unit tests * fix unit test on ad format with parameters * add some unit tests * add unit tests on getBid method * add some test cases in unit tests * minor fix on component id tag. * remove adapters-sticky.json test file * use top most accessible window instead of window.top * Pass in the bid request in the createBid call. * use top most accessible window instead of window.top * add unit tests * update unit tests * fix unit test. * fix CI build * add alias freewheel-ssp * update unit tests on bidderCode value * fix component id values and add unit tests * allws to use any outstream format. * fix ASLoader on futur outstream format versions * minor: fix code format. * update unit tests * minor fix code format * minor: add missing new line at eof * replace StickyAdsTVAdapter by freewheel ssp bd adapter (for prebid 1.0) * remove old stickyadstv unittest spec. * fix server response parsing if sent as object with 'body' field * use the vastXml field for video mediatype * add user sync pixel in freewheel ssp adapter * remove all console log calls (replaced using util helper) * remove useless bidderCode (automatically added by the bidderFactory) * Return the SYNC pixel to be added in the page by Prebid.js * remove instance level properties to enable concurrent bids with the same adapter instance. * fix the request apss through and corresponding unit tests * fix 'freeheelssp' typo * + fixed endpoint request data property names - width to w and height to h (#1955) + updated unit test for the adapter to comply with the property name changes * Added iQM Bid Adapter for Prebid.js 1.0 (#1880) * Added iQM Bid Adapter for Prebid.js 1.0 * Modified URL from http to https * Removed geo function which was fetching user location. * Remove stray console.log (#1975) * Remove duplicate request id and fix empty response from getHighesCpmBids, getAdserverTargeting (#1970) * Removed requestId and added auctionId * Updated module fixtures to use auctionId and not requestId * remove request id from external bid object and fix bug for empty result in public api * use auctionId instead of requestId * fixed lint errors * [Add BidAdapter] rxrtb adapter for Perbid.js 1.0 (#1950) * Add: rxrtb prebidAdapter * Update: params for test * Update: code format * Update: code format * Update: code format * ServerBid Server BidAdapter (#1819) * ServerBid Server BidAdapter Allow S2S configuration with ServerBid. * Updates to meet 1.0 callBids/config changes. * Fix linting issues. * added hb_source to default keys (#1969) * added hb_source * dropped function to add hb_source since it is now default key * fixed lint error * Prebid 1.1.0 Release * Increment pre version * S2s defaults fix in serverbidServerBidAdapter (#1986) * removed s2s defaults * start timestamp was missing on s2s requests * remove hardcoded localhost port for tests (#1988) * Fixes unit tests in browsers other than chrome (#1987) * Fixes unit tests in browsers other than chrome * fixed lint errors * Prebid 1.1.1 Release * Add note about docs needed before merge (#1959) * Add note about docs needed before merge * Update pr_review.md * Update pr_review.md * Update pr_review.md * Adding optional width and height to display parameters (#1998) * adding optional size * no tabs * TrustX adapter update (#1979) * Add trustx adapter and tests for it * update integration example * Update trustx adapter * Post-review fixes of Trustx adapter * Code improvement for trustx adapter: changed default price type from gross to net * Update TrustX adapter to support the 1.0 version * Make requested changes for TrustX adapter * Updated markdown file for TrustX adapter * Fix TrustX adapter and spec file * Update TrustX adapter: r parameter was added to ad request as cache buster * Serverbid Bid Adapter: Add new ad sizes (#1983) * Added dynamic ttl property for One Display and One Mobile. (#2004) * pin gulp-connect at non-broken version (#2008) * pin gulp-connect at non-broken version * updated yarn.lock to specify pinned gulp-connect * Gjirafa Bidder Adapter (#1944) * Added Gjirafa adapter * Add gjirafa adapter unit test * adapter update * New line * Requested changes * change hello_world.html to one bid * change hello_world.html to one bid * Dropping changes in gitignore and hello_world example * hello_world changes * Drop hello_world and gitignore * multiformat size validation checks (#1964) * initial commit for multiformat size validation checks * adding unit tests and changes to checkBidRequestSizes function * updates to appnexusBidAdapter * Upgrade Admixer adapter for Prebid 1.0 (#1755) * Migrating to Prebid 1.0 * Migrating to Prebid 1.0 * Fix spec * Add NasmediaAdmixer adapter for Perbid.js 1.0 (#1937) * add NasmediaAdmixer adapter for Perbid.js 1.0 * add NasmediaAdmixer adapter for Perbid.js 1.0 * add NasmediaAdmixer adapter for Perbid.js 1.0 * add NasmediaAdmixer adapter for Perbid.js 1.0 * add NasmediaAdmixer adapter for Perbid.js 1.0 * add NasmediaAdmixer adapter for Perbid.js 1.0 * Added gdpr to adform adapter * Added unit tests * Updated spacing * Update gdprConsent object due to changes in spec --- modules/adformBidAdapter.js | 7 ++++++- test/spec/modules/adformBidAdapter_spec.js | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/adformBidAdapter.js b/modules/adformBidAdapter.js index 1da6042f63a..086877342da 100644 --- a/modules/adformBidAdapter.js +++ b/modules/adformBidAdapter.js @@ -10,7 +10,7 @@ export const spec = { isBidRequestValid: function (bid) { return !!(bid.params.mid); }, - buildRequests: function (validBidRequests) { + buildRequests: function (validBidRequests, bidderRequest) { var i, l, j, k, bid, _key, _value, reqParams; var request = []; var globalParams = [ [ 'adxDomain', 'adx.adform.net' ], [ 'fd', 1 ], [ 'url', null ], [ 'tid', null ], [ 'pt', null ] ]; @@ -38,6 +38,11 @@ export const spec = { request.push('stid=' + validBidRequests[0].auctionId); + if (bidderRequest && bidderRequest.gdprConsent) { + request.push('gdpr=' + bidderRequest.gdprConsent.gdprApplies); + request.push('gdpr_consent=' + bidderRequest.gdprConsent.consentString); + } + for (i = 1, l = globalParams.length; i < l; i++) { _key = globalParams[i][0]; _value = globalParams[i][1]; diff --git a/test/spec/modules/adformBidAdapter_spec.js b/test/spec/modules/adformBidAdapter_spec.js index f3aa735be00..7e4b7ed577a 100644 --- a/test/spec/modules/adformBidAdapter_spec.js +++ b/test/spec/modules/adformBidAdapter_spec.js @@ -87,6 +87,15 @@ describe('Adform adapter', () => { let request = spec.buildRequests([bids[0]]); assert.deepEqual(resultBids, bids[0]); }); + + it('should send GDPR Consent data to adform', () => { + var resultBids = JSON.parse(JSON.stringify(bids[0])); + let request = spec.buildRequests([bids[0]], {gdprConsent: {gdprApplies: 1, consentString: 'concentDataString'}}); + let parsedUrl = parseUrl(request.url).query; + + assert.equal(parsedUrl.gdpr, 1); + assert.equal(parsedUrl.gdpr_consent, 'concentDataString'); + }); }); describe('interpretResponse', () => {