From c614ecac8068192e1b44980948948dd9da99035a Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Wed, 18 May 2022 12:03:30 -0700 Subject: [PATCH] convert bidders: adloox --- modules/adkernelBidAdapter.js | 11 +++++------ modules/adlooxAnalyticsAdapter.js | 2 +- modules/adlooxRtdProvider.js | 2 +- src/refererDetection.js | 3 +-- test/spec/modules/adkernelBidAdapter_spec.js | 3 ++- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/modules/adkernelBidAdapter.js b/modules/adkernelBidAdapter.js index 73464d46219..833485d8dc7 100644 --- a/modules/adkernelBidAdapter.js +++ b/modules/adkernelBidAdapter.js @@ -226,7 +226,7 @@ registerBidder(spec); * @param refererInfo {refererInfo} */ function groupImpressionsByHostZone(bidRequests, refererInfo) { - let secure = (refererInfo && refererInfo.referer.indexOf('https:') === 0); + let secure = (refererInfo && refererInfo.page?.indexOf('https:') === 0); return Object.values( bidRequests.map(bidRequest => buildImp(bidRequest, secure)) .reduce((acc, curr, index) => { @@ -535,14 +535,13 @@ function getLanguage() { * Creates site description object */ function createSite(refInfo, fpd) { - let url = parseUrl(refInfo.referer); let site = { - 'domain': url.hostname, - 'page': `${url.protocol}://${url.hostname}${url.pathname}` + 'domain': refInfo.domain, + 'page': refInfo.page }; mergeDeep(site, fpd.site); - if (!inIframe() && document.referrer) { - site.ref = document.referrer; + if (refInfo.ref != null) { + site.ref = refInfo.ref; } else { delete site.ref; } diff --git a/modules/adlooxAnalyticsAdapter.js b/modules/adlooxAnalyticsAdapter.js index 1091b87a22d..36bdd4a44cf 100644 --- a/modules/adlooxAnalyticsAdapter.js +++ b/modules/adlooxAnalyticsAdapter.js @@ -61,7 +61,7 @@ MACRO['creatype'] = function(b, c) { }; MACRO['pageurl'] = function(b, c) { const refererInfo = getRefererInfo(); - return (refererInfo.canonicalUrl || refererInfo.referer || '').substr(0, 300).split(/[?#]/)[0]; + return (refererInfo.page || '').substr(0, 300).split(/[?#]/)[0]; }; MACRO['pbadslot'] = function(b, c) { const adUnit = find(auctionManager.getAdUnits(), a => b.adUnitCode === a.code); diff --git a/modules/adlooxRtdProvider.js b/modules/adlooxRtdProvider.js index 0a224eca0e5..a839f8e0ddd 100644 --- a/modules/adlooxRtdProvider.js +++ b/modules/adlooxRtdProvider.js @@ -306,7 +306,7 @@ function getBidRequestData(reqBidsConfigObj, callback, config, userConsent) { [ 'imp', config.params.imps ], [ 'fc_ip', config.params.freqcap_ip ], [ 'fc_ipua', config.params.freqcap_ipua ], - [ 'pn', (refererInfo.canonicalUrl || refererInfo.referer || '').substr(0, 300).split(/[?#]/)[0] ] + [ 'pn', (refererInfo.page || '').substr(0, 300).split(/[?#]/)[0] ] ]; if (!adUnits.length) { diff --git a/src/refererDetection.js b/src/refererDetection.js index 764e8852e40..f6cf509d5ac 100644 --- a/src/refererDetection.js +++ b/src/refererDetection.js @@ -251,8 +251,7 @@ export function detectReferer(win) { * @property {string|null} page the best candidate for the current page URL: `canonicalUrl`, falling back to `location` * @property {string|null} domain the domain portion of `page` * @property {string|null} the referrer (document.referrer) to the current page, or null if not available (due to cross-origin restricitons) - * @property {string} topmostLocation of the top-most frame for which we could guess the location. Outside of cross-origin scenarios, this is - * equivalent to `location`. + * @property {string} topmostLocation of the top-most frame for which we could guess the location. Outside of cross-origin scenarios, this is equivalent to `location`. * @property {number} numIframes number of steps between window.self and window.top * @property {Array[string|null]} stack our best guess at the location for each frame, in the direction top -> self. */ diff --git a/test/spec/modules/adkernelBidAdapter_spec.js b/test/spec/modules/adkernelBidAdapter_spec.js index ab1c5501bd9..4b0eebdf519 100644 --- a/test/spec/modules/adkernelBidAdapter_spec.js +++ b/test/spec/modules/adkernelBidAdapter_spec.js @@ -3,6 +3,7 @@ import {spec} from 'modules/adkernelBidAdapter'; import * as utils from 'src/utils'; import {NATIVE, BANNER, VIDEO} from 'src/mediaTypes'; import {config} from 'src/config'; +import {parseDomain} from '../../../src/refererDetection.js'; describe('Adkernel adapter', function () { const bid1_zone1 = { @@ -253,7 +254,7 @@ describe('Adkernel adapter', function () { }); function buildBidderRequest(url = 'https://example.com/index.html', params = {}) { - return Object.assign({}, params, {refererInfo: {referer: url, reachedTop: true}, timeout: 3000, bidderCode: 'adkernel'}); + return Object.assign({}, params, {refererInfo: {page: url, domain: parseDomain(url), reachedTop: true}, timeout: 3000, bidderCode: 'adkernel'}); } const DEFAULT_BIDDER_REQUEST = buildBidderRequest();