From 7281e547e2a94e3b90abdc5c635a05b0ddd7c725 Mon Sep 17 00:00:00 2001 From: Jonas Hilsen Date: Tue, 17 Dec 2019 11:01:33 +0000 Subject: [PATCH 1/9] add seedingAlliance Adapter --- modules/seedingAllianceBidAdapter.js | 207 ++++++++++++++++++ modules/seedingAllianceBidAdapter.md | 45 ++++ .../modules/seedingAllianceAdapter_spec.js | 179 +++++++++++++++ 3 files changed, 431 insertions(+) create mode 100755 modules/seedingAllianceBidAdapter.js create mode 100755 modules/seedingAllianceBidAdapter.md create mode 100755 test/spec/modules/seedingAllianceAdapter_spec.js diff --git a/modules/seedingAllianceBidAdapter.js b/modules/seedingAllianceBidAdapter.js new file mode 100755 index 00000000000..e118849e666 --- /dev/null +++ b/modules/seedingAllianceBidAdapter.js @@ -0,0 +1,207 @@ +// jshint esversion: 6, es3: false, node: true +'use strict'; + +import { registerBidder } from '../src/adapters/bidderFactory'; +import { NATIVE } from '../src/mediaTypes'; +import * as utils from '../src/utils'; +import { config } from '../src/config'; + +const BIDDER_CODE = 'seedingAlliance'; +const DEFAULT_CUR = 'EUR'; +const ENDPOINT_URL = 'https://b.nativendo.de/cds/rtb/bid?format=openrtb2.5&ssp=nativendo'; + +const NATIVE_ASSET_IDS = {0: 'title', 1: 'body', 2: 'sponsoredBy', 3: 'image'}; + +const NATIVE_PARAMS = { + title: { + id: 0, + name: 'title' + }, + + body: { + id: 1, + name: 'data', + type: 2 + }, + + sponsoredBy: { + id: 2, + name: 'data', + type: 1 + }, + + image: { + id: 3, + type: 3, + name: 'img' + } +}; + +export const spec = { + code: BIDDER_CODE, + + supportedMediaTypes: [NATIVE], + + isBidRequestValid: function(bid) { + return !!bid.params.adUnitId; + }, + + buildRequests: (validBidRequests, bidderRequest) => { + const pt = setOnAny(validBidRequests, 'params.pt') || setOnAny(validBidRequests, 'params.priceType') || 'net'; + const tid = validBidRequests[0].transactionId; + const cur = [config.getConfig('currency.adServerCurrency') || DEFAULT_CUR]; + let pubcid = null; + let url = bidderRequest.refererInfo.referer; + + const imp = validBidRequests.map((bid, id) => { + const assets = utils._map(bid.nativeParams, (bidParams, key) => { + const props = NATIVE_PARAMS[key]; + + const asset = { + required: bidParams.required & 1 + }; + + if (props) { + asset.id = props.id; + + let w, h; + + if (bidParams.sizes) { + w = bidParams.sizes[0]; + h = bidParams.sizes[1]; + } + + asset[props.name] = { + len: bidParams.len, + type: props.type, + w, + h + }; + + return asset; + } + }) + .filter(Boolean); + + if (bid.params.url) { + url = bid.params.url; + } + + return { + id: String(id + 1), + tagid: bid.params.adUnitId, + tid: tid, + pt: pt, + native: { + request: { + assets + } + } + }; + }); + + if (validBidRequests[0].crumbs && validBidRequests[0].crumbs.pubcid) { + pubcid = validBidRequests[0].crumbs.pubcid; + } + + const request = { + id: bidderRequest.auctionId, + site: { + page: url + }, + device: { + ua: navigator.userAgent + }, + cur, + imp, + user: { + buyeruid: pubcid + } + }; + + return { + method: 'POST', + url: ENDPOINT_URL, + data: JSON.stringify(request), + bids: validBidRequests + }; + }, + + interpretResponse: function(serverResponse, { bids }) { + if (utils.isEmpty(serverResponse.body)) { + return []; + } + + const { seatbid, cur } = serverResponse.body; + + const bidResponses = flatten(seatbid.map(seat => seat.bid)).reduce((result, bid) => { + result[bid.impid - 1] = bid; + return result; + }, []); + + return bids + .map((bid, id) => { + const bidResponse = bidResponses[id]; + + if (bidResponse) { + return { + requestId: bid.bidId, + cpm: bidResponse.price, + creativeId: bidResponse.crid, + ttl: 1000, + netRevenue: bid.netRevenue === 'net', + currency: cur, + mediaType: NATIVE, + bidderCode: BIDDER_CODE, + native: parseNative(bidResponse) + }; + } + }) + .filter(Boolean); + } +}; + +registerBidder(spec); + +function parseNative(bid) { + const {assets, link, imptrackers} = bid.adm.native; + + link.clicktrackers.forEach(function (clicktracker, index) { + link.clicktrackers[index] = clicktracker.replace(/\$\{AUCTION_PRICE\}/, bid.price); + }); + + imptrackers.forEach(function (imptracker, index) { + imptrackers[index] = imptracker.replace(/\$\{AUCTION_PRICE\}/, bid.price); + }); + + const result = { + url: link.url, + clickUrl: link.url, + clickTrackers: link.clicktrackers || undefined, + impressionTrackers: imptrackers || undefined + }; + + assets.forEach(asset => { + const kind = NATIVE_ASSET_IDS[asset.id]; + const content = kind && asset[NATIVE_PARAMS[kind].name]; + + if (content) { + result[kind] = content.text || content.value || { url: content.url, width: content.w, height: content.h }; + } + }); + + return result; +} + +function setOnAny(collection, key) { + for (let i = 0, result; i < collection.length; i++) { + result = utils.deepAccess(collection[i], key); + if (result) { + return result; + } + } +} + +function flatten(arr) { + return [].concat(...arr); +} diff --git a/modules/seedingAllianceBidAdapter.md b/modules/seedingAllianceBidAdapter.md new file mode 100755 index 00000000000..c933e53695b --- /dev/null +++ b/modules/seedingAllianceBidAdapter.md @@ -0,0 +1,45 @@ +# Overview +Module Name: Seeding Alliance Bidder Adapter +Type: Seeding Alliance Adapter +Maintainer: tech@seeding-alliance.de + +# Description +Seeding Alliance Bidder Adapter for Prebid.js. + +# Test Parameters +``` +var adUnits = [{ + code: 'test-div', + + mediaTypes: { + native: { + title: { + required: true, + len: 50 + }, + body: { + required: true, + len: 350 + }, + url: { + required: true + }, + image: { + required: true, + sizes : [300, 175] + }, + sponsoredBy: { + required: true + } + } + }, + bids: [{ + bidder: 'seedingAlliance', + params: { + url : "https://mockup.seeding-alliance.de/ssp-testing/native.html", + adUnitId: "2sq2o" + } + }] +}]; +``` + diff --git a/test/spec/modules/seedingAllianceAdapter_spec.js b/test/spec/modules/seedingAllianceAdapter_spec.js new file mode 100755 index 00000000000..e7915bc2d22 --- /dev/null +++ b/test/spec/modules/seedingAllianceAdapter_spec.js @@ -0,0 +1,179 @@ +// jshint esversion: 6, es3: false, node: true +import {assert, expect} from 'chai'; +import * as url from 'src/url'; +import {spec} from 'modules/seedingAllianceBidAdapter'; +import { NATIVE } from 'src/mediaTypes'; +import { config } from 'src/config'; + +describe('SeedingAlliance adapter', function () { + let serverResponse, bidRequest, bidResponses; + let bid = { + 'bidder': 'seedingAlliance', + 'params': { + 'adUnitId': '1hq8' + } + }; + + describe('isBidRequestValid', function () { + it('should return true when required params found', function () { + assert(spec.isBidRequestValid(bid)); + }); + + it('should return false when AdUnitId is not set', function () { + delete bid.params.adUnitId; + assert.isFalse(spec.isBidRequestValid(bid)); + }); + }); + + describe('buildRequests', function () { + it('should send request with correct structure', function () { + let validBidRequests = [{ + bidId: 'bidId', + params: {} + }]; + + let request = spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }); + + assert.equal(request.method, 'POST'); + assert.ok(request.data); + }); + + it('should have default request structure', function () { + let keys = 'site,device,cur,imp,user'.split(','); + let validBidRequests = [{ + bidId: 'bidId', + params: {} + }]; + let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data); + let data = Object.keys(request); + + assert.deepEqual(keys, data); + }); + + it('Verify the auction ID', function () { + let validBidRequests = [{ + bidId: 'bidId', + params: {}, + auctionId: 'auctionId' + }]; + let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' }, auctionId: validBidRequests[0].auctionId }).data); + + assert.equal(request.id, validBidRequests[0].auctionId); + }); + + it('Verify the device', function () { + let validBidRequests = [{ + bidId: 'bidId', + params: {} + }]; + let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data); + + assert.equal(request.device.ua, navigator.userAgent); + }); + + it('Verify native asset ids', function () { + let validBidRequests = [{ + bidId: 'bidId', + params: {}, + nativeParams: { + body: { + required: true, + len: 350 + }, + image: { + required: true + }, + title: { + required: true + }, + sponsoredBy: { + required: true + } + } + }]; + + let assets = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { referer: 'page' } }).data).imp[0].native.request.assets; + + assert.equal(assets[0].id, 1); + assert.equal(assets[1].id, 3); + assert.equal(assets[2].id, 0); + assert.equal(assets[3].id, 2); + }); + }); + + describe('interpretResponse', function () { + const goodResponse = { + body: { + cur: 'EUR', + id: '4b516b80-886e-4ec0-82ae-9209e6d625fb', + seatbid: [ + { + seat: 'seedingAlliance', + bid: [{ + adm: { + native: { + assets: [ + {id: 0, title: {text: 'this is a title'}} + ], + imptrackers: ['https://domain.for/imp/tracker?price=${AUCTION_PRICE}'], + link: { + clicktrackers: ['https://domain.for/imp/tracker?price=${AUCTION_PRICE}'], + url: 'https://domain.for/ad/' + } + } + }, + impid: 1, + price: 0.55 + }] + } + ] + } + }; + const badResponse = { body: { + cur: 'EUR', + id: '4b516b80-886e-4ec0-82ae-9209e6d625fb', + seatbid: [] + }}; + + const bidRequest = { + data: {}, + bids: [{ bidId: 'bidId1' }] + }; + + it('should return null if body is missing or empty', function () { + const result = spec.interpretResponse(badResponse, bidRequest); + assert.equal(result.length, 0); + + delete badResponse.body + + const result1 = spec.interpretResponse(badResponse, bidRequest); + assert.equal(result.length, 0); + }); + + it('should return the correct params', function () { + const result = spec.interpretResponse(goodResponse, bidRequest); + const bid = goodResponse.body.seatbid[0].bid[0]; + + assert.deepEqual(result[0].currency, goodResponse.body.cur); + assert.deepEqual(result[0].requestId, bidRequest.bids[0].bidId); + assert.deepEqual(result[0].cpm, bid.price); + assert.deepEqual(result[0].creativeId, bid.crid); + assert.deepEqual(result[0].mediaType, 'native'); + assert.deepEqual(result[0].bidderCode, 'seedingAlliance'); + }); + + it('should return the correct tracking links', function () { + const result = spec.interpretResponse(goodResponse, bidRequest); + const bid = goodResponse.body.seatbid[0].bid[0]; + const regExpPrice = new RegExp('price=' + bid.price); + + result[0].native.clickTrackers.forEach(function (clickTracker) { + assert.ok(clickTracker.search(regExpPrice) > -1); + }); + + result[0].native.impressionTrackers.forEach(function (impTracker) { + assert.ok(impTracker.search(regExpPrice) > -1); + }); + }); + }); +}); From 043b2a0327020db614639624b39b679926e97868 Mon Sep 17 00:00:00 2001 From: Jonas Hilsen Date: Tue, 11 Feb 2020 13:26:26 +0000 Subject: [PATCH 2/9] add two native default params --- modules/seedingAllianceBidAdapter.js | 14 +++++++++++++- test/spec/modules/seedingAllianceAdapter_spec.js | 8 ++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/seedingAllianceBidAdapter.js b/modules/seedingAllianceBidAdapter.js index e118849e666..54f161287bd 100755 --- a/modules/seedingAllianceBidAdapter.js +++ b/modules/seedingAllianceBidAdapter.js @@ -10,7 +10,7 @@ const BIDDER_CODE = 'seedingAlliance'; const DEFAULT_CUR = 'EUR'; const ENDPOINT_URL = 'https://b.nativendo.de/cds/rtb/bid?format=openrtb2.5&ssp=nativendo'; -const NATIVE_ASSET_IDS = {0: 'title', 1: 'body', 2: 'sponsoredBy', 3: 'image'}; +const NATIVE_ASSET_IDS = {0: 'title', 1: 'body', 2: 'sponsoredBy', 3: 'image', 4: 'cta', 5: 'icon'}; const NATIVE_PARAMS = { title: { @@ -34,6 +34,18 @@ const NATIVE_PARAMS = { id: 3, type: 3, name: 'img' + }, + + cta: { + id: 4, + type: 12, + name: 'data' + }, + + icon: { + id: 5, + type: 1, + name: 'img' } }; diff --git a/test/spec/modules/seedingAllianceAdapter_spec.js b/test/spec/modules/seedingAllianceAdapter_spec.js index e7915bc2d22..f4c833b41a8 100755 --- a/test/spec/modules/seedingAllianceAdapter_spec.js +++ b/test/spec/modules/seedingAllianceAdapter_spec.js @@ -88,6 +88,12 @@ describe('SeedingAlliance adapter', function () { }, sponsoredBy: { required: true + }, + cta: { + required: true + }, + icon: { + required: true } } }]; @@ -98,6 +104,8 @@ describe('SeedingAlliance adapter', function () { assert.equal(assets[1].id, 3); assert.equal(assets[2].id, 0); assert.equal(assets[3].id, 2); + assert.equal(assets[4].id, 4); + assert.equal(assets[5].id, 5); }); }); From bd9a1cd20457ed3fc4505573266e2b1ad8cbafa1 Mon Sep 17 00:00:00 2001 From: Jonas Hilsen Date: Tue, 11 Feb 2020 13:58:44 +0000 Subject: [PATCH 3/9] ... --- modules/seedingAllianceBidAdapter.js | 16 ++-------------- test/spec/modules/seedingAllianceAdapter_spec.js | 8 -------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/modules/seedingAllianceBidAdapter.js b/modules/seedingAllianceBidAdapter.js index 54f161287bd..6050eba0323 100755 --- a/modules/seedingAllianceBidAdapter.js +++ b/modules/seedingAllianceBidAdapter.js @@ -10,7 +10,7 @@ const BIDDER_CODE = 'seedingAlliance'; const DEFAULT_CUR = 'EUR'; const ENDPOINT_URL = 'https://b.nativendo.de/cds/rtb/bid?format=openrtb2.5&ssp=nativendo'; -const NATIVE_ASSET_IDS = {0: 'title', 1: 'body', 2: 'sponsoredBy', 3: 'image', 4: 'cta', 5: 'icon'}; +const NATIVE_ASSET_IDS = {0: 'title', 1: 'body', 2: 'sponsoredBy', 3: 'image'}; const NATIVE_PARAMS = { title: { @@ -34,18 +34,6 @@ const NATIVE_PARAMS = { id: 3, type: 3, name: 'img' - }, - - cta: { - id: 4, - type: 12, - name: 'data' - }, - - icon: { - id: 5, - type: 1, - name: 'img' } }; @@ -216,4 +204,4 @@ function setOnAny(collection, key) { function flatten(arr) { return [].concat(...arr); -} +} \ No newline at end of file diff --git a/test/spec/modules/seedingAllianceAdapter_spec.js b/test/spec/modules/seedingAllianceAdapter_spec.js index f4c833b41a8..e7915bc2d22 100755 --- a/test/spec/modules/seedingAllianceAdapter_spec.js +++ b/test/spec/modules/seedingAllianceAdapter_spec.js @@ -88,12 +88,6 @@ describe('SeedingAlliance adapter', function () { }, sponsoredBy: { required: true - }, - cta: { - required: true - }, - icon: { - required: true } } }]; @@ -104,8 +98,6 @@ describe('SeedingAlliance adapter', function () { assert.equal(assets[1].id, 3); assert.equal(assets[2].id, 0); assert.equal(assets[3].id, 2); - assert.equal(assets[4].id, 4); - assert.equal(assets[5].id, 5); }); }); From bfe4fdfd166bad54e4c16c09feda413536358ae1 Mon Sep 17 00:00:00 2001 From: Jonas Hilsen Date: Tue, 11 Feb 2020 14:06:44 +0000 Subject: [PATCH 4/9] ... --- modules/seedingAllianceBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/seedingAllianceBidAdapter.js b/modules/seedingAllianceBidAdapter.js index 6050eba0323..e118849e666 100755 --- a/modules/seedingAllianceBidAdapter.js +++ b/modules/seedingAllianceBidAdapter.js @@ -204,4 +204,4 @@ function setOnAny(collection, key) { function flatten(arr) { return [].concat(...arr); -} \ No newline at end of file +} From 1771978f89945529f909211bce3e1ceacadd7450 Mon Sep 17 00:00:00 2001 From: Jonas Hilsen Date: Tue, 11 Feb 2020 14:10:01 +0000 Subject: [PATCH 5/9] seedingAlliance Adapter: add two more default native params --- modules/seedingAllianceBidAdapter.js | 14 +++++++++++++- test/spec/modules/seedingAllianceAdapter_spec.js | 8 ++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/seedingAllianceBidAdapter.js b/modules/seedingAllianceBidAdapter.js index e118849e666..54f161287bd 100755 --- a/modules/seedingAllianceBidAdapter.js +++ b/modules/seedingAllianceBidAdapter.js @@ -10,7 +10,7 @@ const BIDDER_CODE = 'seedingAlliance'; const DEFAULT_CUR = 'EUR'; const ENDPOINT_URL = 'https://b.nativendo.de/cds/rtb/bid?format=openrtb2.5&ssp=nativendo'; -const NATIVE_ASSET_IDS = {0: 'title', 1: 'body', 2: 'sponsoredBy', 3: 'image'}; +const NATIVE_ASSET_IDS = {0: 'title', 1: 'body', 2: 'sponsoredBy', 3: 'image', 4: 'cta', 5: 'icon'}; const NATIVE_PARAMS = { title: { @@ -34,6 +34,18 @@ const NATIVE_PARAMS = { id: 3, type: 3, name: 'img' + }, + + cta: { + id: 4, + type: 12, + name: 'data' + }, + + icon: { + id: 5, + type: 1, + name: 'img' } }; diff --git a/test/spec/modules/seedingAllianceAdapter_spec.js b/test/spec/modules/seedingAllianceAdapter_spec.js index e7915bc2d22..f4c833b41a8 100755 --- a/test/spec/modules/seedingAllianceAdapter_spec.js +++ b/test/spec/modules/seedingAllianceAdapter_spec.js @@ -88,6 +88,12 @@ describe('SeedingAlliance adapter', function () { }, sponsoredBy: { required: true + }, + cta: { + required: true + }, + icon: { + required: true } } }]; @@ -98,6 +104,8 @@ describe('SeedingAlliance adapter', function () { assert.equal(assets[1].id, 3); assert.equal(assets[2].id, 0); assert.equal(assets[3].id, 2); + assert.equal(assets[4].id, 4); + assert.equal(assets[5].id, 5); }); }); From 717c487318fffa868c7418975c51551a90ef25c3 Mon Sep 17 00:00:00 2001 From: Jonas Hilsen Date: Mon, 20 Jul 2020 13:07:25 +0000 Subject: [PATCH 6/9] updating seedingAlliance Adapter --- modules/seedingAllianceBidAdapter.js | 20 ++++++++++++------- .../modules/seedingAllianceAdapter_spec.js | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/seedingAllianceBidAdapter.js b/modules/seedingAllianceBidAdapter.js index b6acd7214a2..d85ae856317 100755 --- a/modules/seedingAllianceBidAdapter.js +++ b/modules/seedingAllianceBidAdapter.js @@ -62,7 +62,6 @@ export const spec = { const pt = setOnAny(validBidRequests, 'params.pt') || setOnAny(validBidRequests, 'params.priceType') || 'net'; const tid = validBidRequests[0].transactionId; const cur = [config.getConfig('currency.adServerCurrency') || DEFAULT_CUR]; - let pubcid = null; let url = bidderRequest.refererInfo.referer; const imp = validBidRequests.map((bid, id) => { @@ -112,10 +111,6 @@ export const spec = { }; }); - if (validBidRequests[0].crumbs && validBidRequests[0].crumbs.pubcid) { - pubcid = validBidRequests[0].crumbs.pubcid; - } - const request = { id: bidderRequest.auctionId, site: { @@ -126,15 +121,26 @@ export const spec = { }, cur, imp, - user: { - buyeruid: pubcid + user: {}, + regs: { + ext: { + gdpr: 0 + } } }; + if (bidderRequest && bidderRequest.gdprConsent) { + utils.deepSetValue(request, 'user.ext.consent', bidderRequest.gdprConsent.consentString); + utils.deepSetValue(request, 'regs.ext.gdpr', (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean' && bidderRequest.gdprConsent.gdprApplies) ? 1 : 0); + } + return { method: 'POST', url: ENDPOINT_URL, data: JSON.stringify(request), + options: { + contentType: 'application/json' + }, bids: validBidRequests }; }, diff --git a/test/spec/modules/seedingAllianceAdapter_spec.js b/test/spec/modules/seedingAllianceAdapter_spec.js index e6f96c92fd9..81af9546ff0 100755 --- a/test/spec/modules/seedingAllianceAdapter_spec.js +++ b/test/spec/modules/seedingAllianceAdapter_spec.js @@ -38,7 +38,7 @@ describe('SeedingAlliance adapter', function () { }); it('should have default request structure', function () { - let keys = 'site,device,cur,imp,user'.split(','); + let keys = 'site,device,cur,imp,user,regs'.split(','); let validBidRequests = [{ bidId: 'bidId', params: {} From 26eaa2bf93124113d988ac55c471861af76b17cd Mon Sep 17 00:00:00 2001 From: Jonas Hilsen Date: Thu, 16 Sep 2021 08:50:34 +0000 Subject: [PATCH 7/9] seedingAlliance Adapter --- modules/seedingAllianceBidAdapter.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/seedingAllianceBidAdapter.js b/modules/seedingAllianceBidAdapter.js index d85ae856317..258830d422a 100755 --- a/modules/seedingAllianceBidAdapter.js +++ b/modules/seedingAllianceBidAdapter.js @@ -171,7 +171,10 @@ export const spec = { currency: cur, mediaType: NATIVE, bidderCode: BIDDER_CODE, - native: parseNative(bidResponse) + native: parseNative(bidResponse), + meta: { + advertiserDomains: bidResponse.adomain && bidResponse.adomain.length > 0 ? bidResponse.adomain : [] + } }; } }) @@ -184,13 +187,16 @@ registerBidder(spec); function parseNative(bid) { const {assets, link, imptrackers} = bid.adm.native; - link.clicktrackers.forEach(function (clicktracker, index) { - link.clicktrackers[index] = clicktracker.replace(/\$\{AUCTION_PRICE\}/, bid.price); - }); - - imptrackers.forEach(function (imptracker, index) { - imptrackers[index] = imptracker.replace(/\$\{AUCTION_PRICE\}/, bid.price); - }); + if (link.clicktrackers) { + link.clicktrackers.forEach(function (clicktracker, index) { + link.clicktrackers[index] = clicktracker.replace(/\$\{AUCTION_PRICE\}/, bid.price); + }); + } + if (imptrackers) { + imptrackers.forEach(function (imptracker, index) { + imptrackers[index] = imptracker.replace(/\$\{AUCTION_PRICE\}/, bid.price); + }); + } const result = { url: link.url, From 94d9903bbbeb93bbadb0992f0535d0b95ff9372d Mon Sep 17 00:00:00 2001 From: Jonas Hilsen Date: Fri, 7 Jan 2022 09:01:42 +0000 Subject: [PATCH 8/9] quickfix no bids + net revenue --- modules/seedingAllianceBidAdapter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/seedingAllianceBidAdapter.js b/modules/seedingAllianceBidAdapter.js index 00f3b64fb44..b7aec0f8881 100755 --- a/modules/seedingAllianceBidAdapter.js +++ b/modules/seedingAllianceBidAdapter.js @@ -152,10 +152,10 @@ export const spec = { const { seatbid, cur } = serverResponse.body; - const bidResponses = flatten(seatbid.map(seat => seat.bid)).reduce((result, bid) => { + const bidResponses = (typeof seatbid != 'undefined') ? flatten(seatbid.map(seat => seat.bid)).reduce((result, bid) => { result[bid.impid - 1] = bid; return result; - }, []); + }, []) : []; return bids .map((bid, id) => { @@ -167,7 +167,7 @@ export const spec = { cpm: bidResponse.price, creativeId: bidResponse.crid, ttl: 1000, - netRevenue: bid.netRevenue === 'net', + netRevenue: (!bid.netRevenue || bid.netRevenue === 'net'), currency: cur, mediaType: NATIVE, bidderCode: BIDDER_CODE, From ab915a0a86dc36554a6e7945982ac9f795772c1e Mon Sep 17 00:00:00 2001 From: Jonas Hilsen Date: Tue, 5 Apr 2022 08:41:14 +0000 Subject: [PATCH 9/9] bugfix replace auction price --- modules/seedingAllianceBidAdapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/seedingAllianceBidAdapter.js b/modules/seedingAllianceBidAdapter.js index b7aec0f8881..05dcf15909a 100755 --- a/modules/seedingAllianceBidAdapter.js +++ b/modules/seedingAllianceBidAdapter.js @@ -189,12 +189,12 @@ function parseNative(bid) { if (link.clicktrackers) { link.clicktrackers.forEach(function (clicktracker, index) { - link.clicktrackers[index] = clicktracker.replace(/\$\{AUCTION_PRICE\}/, bid.price); + link.clicktrackers[index] = clicktracker.replace(/\$\{AUCTION_PRICE\}/g, bid.price); }); } if (imptrackers) { imptrackers.forEach(function (imptracker, index) { - imptrackers[index] = imptracker.replace(/\$\{AUCTION_PRICE\}/, bid.price); + imptrackers[index] = imptracker.replace(/\$\{AUCTION_PRICE\}/g, bid.price); }); }