From 7f5c15ac4fd80a928df24cb7de762cfb3dd085b3 Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Fri, 20 May 2022 09:31:43 -0700 Subject: [PATCH] convert bidders: deltaprojects --- modules/cwireBidAdapter.js | 3 +-- modules/dailyhuntBidAdapter.js | 2 +- modules/datablocksBidAdapter.js | 5 +++-- modules/deepintentBidAdapter.js | 14 +++----------- modules/deltaprojectsBidAdapter.js | 7 +++---- test/spec/modules/deltaprojectsBidAdapter_spec.js | 3 ++- 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/modules/cwireBidAdapter.js b/modules/cwireBidAdapter.js index c0a24b49a3c..27ce764be58 100644 --- a/modules/cwireBidAdapter.js +++ b/modules/cwireBidAdapter.js @@ -1,5 +1,4 @@ import {registerBidder} from '../src/adapters/bidderFactory.js'; -import {getRefererInfo} from '../src/refererDetection.js'; import {getStorageManager} from '../src/storageManager.js'; import {BANNER, VIDEO} from '../src/mediaTypes.js'; import {OUTSTREAM} from '../src/video.js'; @@ -170,7 +169,7 @@ export const spec = { let slots = []; let referer; try { - referer = getRefererInfo().referer; + referer = bidderRequest?.refererInfo?.page; slots = mapSlotsData(validBidRequests); } catch (e) { logWarn(e); diff --git a/modules/dailyhuntBidAdapter.js b/modules/dailyhuntBidAdapter.js index ffa84ff88fd..590f3e79f85 100644 --- a/modules/dailyhuntBidAdapter.js +++ b/modules/dailyhuntBidAdapter.js @@ -96,7 +96,7 @@ const flatten = (arr) => { const createOrtbRequest = (validBidRequests, bidderRequest) => { let device = createOrtbDeviceObj(validBidRequests); let user = createOrtbUserObj(validBidRequests) - let site = createOrtbSiteObj(validBidRequests, bidderRequest.refererInfo.referer) + let site = createOrtbSiteObj(validBidRequests, bidderRequest.refererInfo.page) return { id: bidderRequest.auctionId, imp: [], diff --git a/modules/datablocksBidAdapter.js b/modules/datablocksBidAdapter.js index 4959d413a53..fb036d4ff0c 100644 --- a/modules/datablocksBidAdapter.js +++ b/modules/datablocksBidAdapter.js @@ -347,10 +347,11 @@ export const spec = { // GENERATE SITE OBJECT let site = { domain: window.location.host, - page: bidderRequest.refererInfo.referer, + // TODO: is 'page' the right value here? + page: bidderRequest.refererInfo.page, schain: validRequests[0].schain || {}, ext: { - p_domain: config.getConfig('publisherDomain'), + p_domain: bidderRequest.refererInfo.domain, rt: bidderRequest.refererInfo.reachedTop, frames: bidderRequest.refererInfo.numIframes, stack: bidderRequest.refererInfo.stack, diff --git a/modules/deepintentBidAdapter.js b/modules/deepintentBidAdapter.js index 94167b92bb0..e062686b320 100644 --- a/modules/deepintentBidAdapter.js +++ b/modules/deepintentBidAdapter.js @@ -262,21 +262,13 @@ function buildBanner(bid) { function buildSite(bidderRequest) { let site = {}; - if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) { - site.page = bidderRequest.refererInfo.referer; - site.domain = getDomain(bidderRequest.refererInfo.referer); + if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page) { + site.page = bidderRequest.refererInfo.page; + site.domain = bidderRequest.refererInfo.domain; } return site; } -function getDomain(referer) { - if (referer) { - let domainA = document.createElement('a'); - domainA.href = referer; - return domainA.hostname; - } -} - function buildDevice() { return { ua: navigator.userAgent, diff --git a/modules/deltaprojectsBidAdapter.js b/modules/deltaprojectsBidAdapter.js index 33df5bd252e..a9373c7c38e 100644 --- a/modules/deltaprojectsBidAdapter.js +++ b/modules/deltaprojectsBidAdapter.js @@ -32,14 +32,13 @@ function buildRequests(validBidRequests, bidderRequest) { const id = bidderRequest.auctionId; // -- build site - const loc = parseUrl(bidderRequest.refererInfo.referer); const publisherId = setOnAny(validBidRequests, 'params.publisherId'); const siteId = setOnAny(validBidRequests, 'params.siteId'); const site = { id: siteId, - domain: loc.hostname, - page: loc.href, - ref: loc.href, + domain: bidderRequest.refererInfo.domain, + page: bidderRequest.refererInfo.page, + ref: bidderRequest.refererInfo.ref, publisher: { id: publisherId }, }; diff --git a/test/spec/modules/deltaprojectsBidAdapter_spec.js b/test/spec/modules/deltaprojectsBidAdapter_spec.js index 382415eab62..b966d1580ca 100644 --- a/test/spec/modules/deltaprojectsBidAdapter_spec.js +++ b/test/spec/modules/deltaprojectsBidAdapter_spec.js @@ -7,6 +7,7 @@ import { } from 'modules/deltaprojectsBidAdapter.js'; const BID_REQ_REFER = 'http://example.com/page?param=val'; +const BID_REQ_DOMAIN = 'example.com' describe('deltaprojectsBidAdapter', function() { describe('isBidRequestValid', function () { @@ -62,7 +63,7 @@ describe('deltaprojectsBidAdapter', function() { auctionId: '1d1a030790a475', } const bidRequests = [BIDREQ]; - const bannerRequest = spec.buildRequests(bidRequests, {refererInfo: { referer: BID_REQ_REFER }})[0]; + const bannerRequest = spec.buildRequests(bidRequests, {refererInfo: { page: BID_REQ_REFER, domain: BID_REQ_DOMAIN }})[0]; const bannerRequestBody = bannerRequest.data; it('send bid request with test tag if it is set in the param', function () {