From 257b37ed3f1a1f7cf5364ca0e626be579b9f0cf5 Mon Sep 17 00:00:00 2001 From: Tomasz Swirski Date: Wed, 17 Aug 2022 16:30:59 +0200 Subject: [PATCH 1/3] Added sda into rtbhouse adapter --- integrationExamples/gpt/gdpr_hello_world.html | 65 +++++++++++++++++-- integrationExamples/gpt/hello_world.html | 24 +++++-- modules/rtbhouseBidAdapter.js | 3 +- 3 files changed, 81 insertions(+), 11 deletions(-) diff --git a/integrationExamples/gpt/gdpr_hello_world.html b/integrationExamples/gpt/gdpr_hello_world.html index c62569cfc4f..faf0f2e6ba6 100644 --- a/integrationExamples/gpt/gdpr_hello_world.html +++ b/integrationExamples/gpt/gdpr_hello_world.html @@ -29,12 +29,13 @@ // Replace this object to test a new Adapter! bids: [{ - bidder: 'appnexus', - params: { - placementId: 13144370 - } + bidder: "rtbhouse", + params: { + region: "prebid-eu", //required + publisherId: "test", //required, + bidfloor: 0.01 // optional, + } }] - }]; var pbjs = pbjs || {}; @@ -61,6 +62,60 @@ enable: false } }); + pbjs.setBidderConfig({ + bidders: ["rtbhouse"], + config: { + ortb2: { + site: { + name: "example", + domain: "page.example.com", + cat: ["IAB2"], + sectioncat: ["IAB2-2"], + pagecat: ["IAB2-2"], + page: "https://page.example.com/here.html", + ref: "https://ref.example.com", + keywords: "power tools, drills", + search: "drill", + content: { + userrating: "4", + data: [{ + name: "www.dataprovider1.com", + ext: { + segtax: 7, + cids: [ "iris_c73g5jq96mwso4d8" ] + }, + segment: [ + { id: "687" }, + { id: "123" } + ] + }] + }, + ext: { + data: { // fields that aren't part of openrtb 2.5 + pageType: "article", + category: "repair" + } + } + }, + user: { + yob: 1985, + gender: "m", + keywords: "a,b", + data: [{ + name: "dataprovider.com", + ext: {segtax: 4 }, + segment: [{ id: "1" }] + }], + ext: { + data: { + registered: true, + interests: ["cars"] + } + } + } + }, + }, + }); pbjs.requestBids({ bidsBackHandler: sendAdserverRequest, timeout: PREBID_TIMEOUT diff --git a/integrationExamples/gpt/hello_world.html b/integrationExamples/gpt/hello_world.html index 47ba5b8f18a..b8ea885947d 100755 --- a/integrationExamples/gpt/hello_world.html +++ b/integrationExamples/gpt/hello_world.html @@ -24,11 +24,12 @@ }, // Replace this object to test a new Adapter! bids: [{ - bidder: 'appnexus', + bidder: "rtbhouse", params: { - placementId: 13144370 - } - }] + region: "prebid-eu", //required + publisherId: "test", //required, + bidfloor: 0.01 // optional, + }}] }]; @@ -46,6 +47,21 @@ pbjs.que.push(function() { pbjs.addAdUnits(adUnits); + pbjs.setBidderConfig({ + bidders: ["rtbhouse"], + config: { + ortb2: { + user: { + ext: { + data: { + registered: true, + interests: ["cars"], + }, + }, + }, + }, + }, + }); pbjs.requestBids({ bidsBackHandler: sendAdserverRequest, timeout: PREBID_TIMEOUT diff --git a/modules/rtbhouseBidAdapter.js b/modules/rtbhouseBidAdapter.js index dfbfcf481ef..ae687166d2d 100644 --- a/modules/rtbhouseBidAdapter.js +++ b/modules/rtbhouseBidAdapter.js @@ -61,7 +61,7 @@ export const spec = { ? bidderRequest.gdprConsent.consentString.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '') : ''; const gdpr = bidderRequest.gdprConsent.gdprApplies ? 1 : 0; request.regs = {ext: {gdpr: gdpr}}; - request.user = {ext: {consent: consentStr}}; + request.user = {ext: {consent: consentStr, data: bidderRequest.ortb2}}; } if (validBidRequests[0].schain) { const schain = mapSchain(validBidRequests[0].schain); @@ -71,7 +71,6 @@ export const spec = { } } } - if (validBidRequests[0].userIdAsEids) { const eids = { eids: validBidRequests[0].userIdAsEids }; if (request.user && request.user.ext) { From e0db59f7862953096b81ae5d9e1659e7d61537de Mon Sep 17 00:00:00 2001 From: Piotr Jaworski Date: Thu, 25 Aug 2022 17:03:06 +0200 Subject: [PATCH 2/3] spreading ortb2: user & site props --- modules/rtbhouseBidAdapter.js | 49 ++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/modules/rtbhouseBidAdapter.js b/modules/rtbhouseBidAdapter.js index ae687166d2d..fdf64483da7 100644 --- a/modules/rtbhouseBidAdapter.js +++ b/modules/rtbhouseBidAdapter.js @@ -61,16 +61,17 @@ export const spec = { ? bidderRequest.gdprConsent.consentString.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '') : ''; const gdpr = bidderRequest.gdprConsent.gdprApplies ? 1 : 0; request.regs = {ext: {gdpr: gdpr}}; - request.user = {ext: {consent: consentStr, data: bidderRequest.ortb2}}; + request.user = {ext: {consent: consentStr}}; } if (validBidRequests[0].schain) { const schain = mapSchain(validBidRequests[0].schain); if (schain) { request.ext = { schain: schain, - } + }; } } + if (validBidRequests[0].userIdAsEids) { const eids = { eids: validBidRequests[0].userIdAsEids }; if (request.user && request.user.ext) { @@ -80,12 +81,28 @@ export const spec = { } } - const clientHints = getClientHints(); - if (clientHints) { - const { device = {} } = request; - const { sua = {} } = device; - device.sua = { ...sua, ...clientHints }; - request.device = device; + const ortb2Params = bidderRequest && bidderRequest.ortb2; + if (ortb2Params?.user) { + request.user = { + ...request.user, + ...(ortb2Params.user.data && { + data: { ...request.user?.data, ...ortb2Params.user.data }, + }), + ...(ortb2Params.user.ext && { + ext: { ...request.user?.ext, ...ortb2Params.user.ext }, + }), + }; + } + if (ortb2Params?.site) { + request.site = { + ...request.site, + ...(ortb2Params.site.content && { + content: { ...request.site?.content, ...ortb2Params.site.content }, + }), + ...(ortb2Params.site.ext && { + ext: { ...request.site?.ext, ...ortb2Params.site.ext }, + }), + }; } return { @@ -427,19 +444,3 @@ function interpretNativeAd(adm) { }); return result; } - -function getClientHints() { - let clientHints = {}; - const { userAgentData = {} } = navigator; - - const { brands = [] } = userAgentData; - if (brands.length > 0) { - clientHints.browsers = brands; - } - - if (Object.keys(clientHints).length === 0) { - clientHints = null; - } - - return clientHints; -} From e7adb7df5f0a5c616e1ade659fee84ef1f09ccef Mon Sep 17 00:00:00 2001 From: Piotr Jaworski Date: Thu, 25 Aug 2022 17:30:05 +0200 Subject: [PATCH 3/3] examples reverted --- integrationExamples/gpt/gdpr_hello_world.html | 65 ++----------------- integrationExamples/gpt/hello_world.html | 24 ++----- 2 files changed, 9 insertions(+), 80 deletions(-) diff --git a/integrationExamples/gpt/gdpr_hello_world.html b/integrationExamples/gpt/gdpr_hello_world.html index faf0f2e6ba6..c62569cfc4f 100644 --- a/integrationExamples/gpt/gdpr_hello_world.html +++ b/integrationExamples/gpt/gdpr_hello_world.html @@ -29,13 +29,12 @@ // Replace this object to test a new Adapter! bids: [{ - bidder: "rtbhouse", - params: { - region: "prebid-eu", //required - publisherId: "test", //required, - bidfloor: 0.01 // optional, - } + bidder: 'appnexus', + params: { + placementId: 13144370 + } }] + }]; var pbjs = pbjs || {}; @@ -62,60 +61,6 @@ enable: false } }); - pbjs.setBidderConfig({ - bidders: ["rtbhouse"], - config: { - ortb2: { - site: { - name: "example", - domain: "page.example.com", - cat: ["IAB2"], - sectioncat: ["IAB2-2"], - pagecat: ["IAB2-2"], - page: "https://page.example.com/here.html", - ref: "https://ref.example.com", - keywords: "power tools, drills", - search: "drill", - content: { - userrating: "4", - data: [{ - name: "www.dataprovider1.com", - ext: { - segtax: 7, - cids: [ "iris_c73g5jq96mwso4d8" ] - }, - segment: [ - { id: "687" }, - { id: "123" } - ] - }] - }, - ext: { - data: { // fields that aren't part of openrtb 2.5 - pageType: "article", - category: "repair" - } - } - }, - user: { - yob: 1985, - gender: "m", - keywords: "a,b", - data: [{ - name: "dataprovider.com", - ext: {segtax: 4 }, - segment: [{ id: "1" }] - }], - ext: { - data: { - registered: true, - interests: ["cars"] - } - } - } - }, - }, - }); pbjs.requestBids({ bidsBackHandler: sendAdserverRequest, timeout: PREBID_TIMEOUT diff --git a/integrationExamples/gpt/hello_world.html b/integrationExamples/gpt/hello_world.html index b8ea885947d..47ba5b8f18a 100755 --- a/integrationExamples/gpt/hello_world.html +++ b/integrationExamples/gpt/hello_world.html @@ -24,12 +24,11 @@ }, // Replace this object to test a new Adapter! bids: [{ - bidder: "rtbhouse", + bidder: 'appnexus', params: { - region: "prebid-eu", //required - publisherId: "test", //required, - bidfloor: 0.01 // optional, - }}] + placementId: 13144370 + } + }] }]; @@ -47,21 +46,6 @@ pbjs.que.push(function() { pbjs.addAdUnits(adUnits); - pbjs.setBidderConfig({ - bidders: ["rtbhouse"], - config: { - ortb2: { - user: { - ext: { - data: { - registered: true, - interests: ["cars"], - }, - }, - }, - }, - }, - }); pbjs.requestBids({ bidsBackHandler: sendAdserverRequest, timeout: PREBID_TIMEOUT