diff --git a/modules/appierBidAdapter.js b/modules/appierBidAdapter.js index ddb2a050e73..12346d15130 100644 --- a/modules/appierBidAdapter.js +++ b/modules/appierBidAdapter.js @@ -44,10 +44,7 @@ export const spec = { const payload = { 'bids': bidRequests, // TODO: please do not pass internal data structures over to the network - 'refererInfo': { - ...bidderRequest.refererInfo, - referer: bidderRequest.refererInfo.topmostLocation, - }, + 'refererInfo': bidderRequest.refererInfo.legacy, 'version': ADAPTER_VERSION }; return [{ diff --git a/modules/asealBidAdapter.js b/modules/asealBidAdapter.js index 855aee65f34..abe0cf907ed 100644 --- a/modules/asealBidAdapter.js +++ b/modules/asealBidAdapter.js @@ -59,7 +59,8 @@ export const spec = { const data = { bids: validBidRequests, - refererInfo: bidderRequest.refererInfo, + // TODO: please do not pass internal data structures over to the network + refererInfo: bidderRequest.refererInfo?.legacy, device: { webSessionId: getTrekWebSessionId(), }, diff --git a/modules/asoBidAdapter.js b/modules/asoBidAdapter.js index bf45b9ee48f..cd6a5a8ffdb 100644 --- a/modules/asoBidAdapter.js +++ b/modules/asoBidAdapter.js @@ -3,6 +3,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js'; import {config} from '../src/config.js'; import {BANNER, VIDEO} from '../src/mediaTypes.js'; import {Renderer} from '../src/Renderer.js'; +import {parseDomain} from '../src/refererDetection.js'; const BIDDER_CODE = 'aso'; const DEFAULT_SERVER_URL = 'https://srv.aso1.net'; @@ -167,28 +168,13 @@ function createRenderer(bid, url) { } function getUrlsInfo(bidderRequest) { - let page = ''; - let referrer = ''; - - const {refererInfo} = bidderRequest; - - if (inIframe()) { - page = refererInfo.referer; - } else { - const w = getWindowTop(); - page = w.location.href; - referrer = w.document.referrer || ''; - } - - page = config.getConfig('pageUrl') || page; - const url = parseUrl(page); - const domain = url.hostname; - + const {page, domain, ref} = bidderRequest.refererInfo; return { - domain, - page, - referrer - }; + // TODO: do the fallbacks make sense here? + page: page || bidderRequest.refererInfo?.topmostLocation, + referrer: ref || '', + domain: domain || parseDomain(bidderRequest?.refererInfo?.topmostLocation) + } } function getSize(paramSizes) { diff --git a/modules/astraoneBidAdapter.js b/modules/astraoneBidAdapter.js index c233e665499..d6bfa4b93ee 100644 --- a/modules/astraoneBidAdapter.js +++ b/modules/astraoneBidAdapter.js @@ -99,7 +99,7 @@ export const spec = { */ buildRequests(validBidRequests, bidderRequest) { const payload = { - url: bidderRequest.refererInfo.referer, + url: bidderRequest.refererInfo.page, cmp: !!bidderRequest.gdprConsent, bidRequests: buildBidRequests(validBidRequests) }; diff --git a/modules/audiencerunBidAdapter.js b/modules/audiencerunBidAdapter.js index 2744e38e820..754a48ede75 100644 --- a/modules/audiencerunBidAdapter.js +++ b/modules/audiencerunBidAdapter.js @@ -71,12 +71,7 @@ function getPageReferer() { * @return {string} */ function getPageUrl(bidderRequest) { - return ( - config.getConfig('pageUrl') || - deepAccess(bidderRequest, 'refererInfo.referer') || - getPageReferer() || - null - ); + return bidderRequest?.refererInfo?.page } export const spec = { @@ -127,10 +122,12 @@ export const spec = { const payload = { libVersion: this.version, - pageUrl: config.getConfig('pageUrl'), + pageUrl: bidderRequest?.refererInfo?.page, + // TODO: does it make sense to find a half-way referer? what should these parameters pick pageReferer: getPageReferer(), - referer: deepAccess(bidderRequest, 'refererInfo.referer'), - refererInfo: deepAccess(bidderRequest, 'refererInfo'), + referer: deepAccess(bidderRequest, 'refererInfo.topmostLocation'), + // TODO: please do not send internal data structures over the network + refererInfo: deepAccess(bidderRequest, 'refererInfo.legacy'), currencyCode: config.getConfig('currency.adServerCurrency'), timeout: config.getConfig('bidderTimeout'), bids, diff --git a/modules/automatadBidAdapter.js b/modules/automatadBidAdapter.js index e3d0d87783a..6b65ac0699c 100644 --- a/modules/automatadBidAdapter.js +++ b/modules/automatadBidAdapter.js @@ -61,9 +61,9 @@ export const spec = { imp: impressions, site: { id: siteId, - domain: window.location.hostname, - page: window.location.href, - ref: bidderRequest.refererInfo ? bidderRequest.refererInfo.referer || null : null, + domain: bidderRequest.refererInfo?.domain, + page: bidderRequest.refererInfo?.page, + ref: bidderRequest.refererInfo?.ref }, } diff --git a/modules/axonixBidAdapter.js b/modules/axonixBidAdapter.js index a790a89a0c1..5435bf09059 100644 --- a/modules/axonixBidAdapter.js +++ b/modules/axonixBidAdapter.js @@ -25,12 +25,11 @@ function getBidFloor(bidRequest) { } function getPageUrl(bidRequest, bidderRequest) { - let pageUrl = config.getConfig('pageUrl'); - + let pageUrl; if (bidRequest.params.referrer) { pageUrl = bidRequest.params.referrer; - } else if (!pageUrl) { - pageUrl = bidderRequest.refererInfo.referer; + } else { + pageUrl = bidderRequest.refererInfo.page; } return bidRequest.params.secure ? pageUrl.replace(/^http:/i, 'https:') : pageUrl; diff --git a/src/refererDetection.js b/src/refererDetection.js index 8cbc278192e..adcd255376e 100644 --- a/src/refererDetection.js +++ b/src/refererDetection.js @@ -240,6 +240,16 @@ export function detectReferer(win) { page, domain: parseDomain(page) || null, ref: ref || null, + // TODO: the "legacy" refererInfo object is provided here, for now, to accomodate + // adapters that decided to just sent it verbatim to their backend. + legacy: { + reachedTop, + isAmp: valuesFromAmp, + numIframes: level - 1, + stack, + referer: bestLocation || null, + canonicalUrl: bestCanonicalUrl || null, + } }; } diff --git a/test/spec/modules/asoBidAdapter_spec.js b/test/spec/modules/asoBidAdapter_spec.js index 0dc779a300d..5ac44cb1db4 100644 --- a/test/spec/modules/asoBidAdapter_spec.js +++ b/test/spec/modules/asoBidAdapter_spec.js @@ -62,7 +62,8 @@ describe('Adserver.Online bidding adapter', function () { refererInfo: { numIframes: 0, reachedTop: true, - referer: 'https://example.com' + page: 'https://example.com', + domain: 'example.com' } }; diff --git a/test/spec/modules/audiencerunBidAdapter_spec.js b/test/spec/modules/audiencerunBidAdapter_spec.js index 7f1e059fa2a..57de8bdb0df 100644 --- a/test/spec/modules/audiencerunBidAdapter_spec.js +++ b/test/spec/modules/audiencerunBidAdapter_spec.js @@ -114,7 +114,8 @@ describe('AudienceRun bid adapter tests', function () { }, refererInfo: { canonicalUrl: undefined, - referer: 'https://example.com', + page: 'https://example.com', + topmostLocation: 'https://example.com', numIframes: 0, reachedTop: true, }, diff --git a/test/spec/modules/axonixBidAdapter_spec.js b/test/spec/modules/axonixBidAdapter_spec.js index a952d527600..37f409e5769 100644 --- a/test/spec/modules/axonixBidAdapter_spec.js +++ b/test/spec/modules/axonixBidAdapter_spec.js @@ -65,7 +65,7 @@ describe('AxonixBidAdapter', function () { gdprApplies: true }, refererInfo: { - referer: 'https://www.prebid.org', + page: 'https://www.prebid.org', canonicalUrl: 'https://www.prebid.org/the/link/to/the/page' } };