From ab4e778fc982ead99eb345508f9b20755ca8299b Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Fri, 20 May 2022 11:32:52 -0700 Subject: [PATCH] convert bidders: loglyft --- modules/lkqdBidAdapter.js | 3 ++- modules/lockerdomeBidAdapter.js | 7 +++---- modules/loglyliftBidAdapter.js | 4 ++-- test/spec/modules/lockerdomeBidAdapter_spec.js | 4 ++-- test/spec/modules/loglyliftBidAdapter_spec.js | 5 +++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/lkqdBidAdapter.js b/modules/lkqdBidAdapter.js index e58c643f4f0..a9d1ab14847 100644 --- a/modules/lkqdBidAdapter.js +++ b/modules/lkqdBidAdapter.js @@ -37,7 +37,8 @@ export const spec = { const UTC_OFFSET = new Date().getTimezoneOffset(); const UA = navigator.userAgent; const USP = BIDDER_REQUEST.uspConsent || null; - const REFERER = BIDDER_REQUEST.refererInfo ? new URL(BIDDER_REQUEST.refererInfo.referer).hostname : window.location.hostname; + // TODO: does the fallback make sense here? + const REFERER = BIDDER_REQUEST?.refererInfo?.domain || window.location.hostname const BIDDER_GDPR = BIDDER_REQUEST.gdprConsent && BIDDER_REQUEST.gdprConsent.gdprApplies ? 1 : null; const BIDDER_GDPRS = BIDDER_REQUEST.gdprConsent && BIDDER_REQUEST.gdprConsent.consentString ? BIDDER_REQUEST.gdprConsent.consentString : null; diff --git a/modules/lockerdomeBidAdapter.js b/modules/lockerdomeBidAdapter.js index 66accb4e02a..5c38753c1e2 100644 --- a/modules/lockerdomeBidAdapter.js +++ b/modules/lockerdomeBidAdapter.js @@ -21,12 +21,11 @@ export const spec = { }; }); - const bidderRequestCanonicalUrl = (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.canonicalUrl) || ''; - const bidderRequestReferer = (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) || ''; const payload = { bidRequests: adUnitBidRequests, - url: encodeURIComponent(bidderRequestCanonicalUrl), - referrer: encodeURIComponent(bidderRequestReferer) + // TODO: are these the right refererInfo values? + url: encodeURIComponent(bidderRequest?.refererInfo?.canonicalUrl || ''), + referrer: encodeURIComponent(bidderRequest?.refererInfo?.topmostLocation || '') }; if (schain) { payload.schain = schain; diff --git a/modules/loglyliftBidAdapter.js b/modules/loglyliftBidAdapter.js index dd5f0af1cdf..a05434e8ee5 100644 --- a/modules/loglyliftBidAdapter.js +++ b/modules/loglyliftBidAdapter.js @@ -69,8 +69,8 @@ function newBidRequest(bid, bidderRequest) { params: bid.params, prebidJsVersion: '$prebid.version$', url: window.location.href, - domain: config.getConfig('publisherDomain'), - referer: bidderRequest.refererInfo.referer, + domain: bidderRequest.refererInfo.domain, + referer: bidderRequest.refererInfo.page, auctionStartTime: bidderRequest.auctionStart, currency: currency, timeout: config.getConfig('bidderTimeout') diff --git a/test/spec/modules/lockerdomeBidAdapter_spec.js b/test/spec/modules/lockerdomeBidAdapter_spec.js index 9e3d7981300..d65837c39ab 100644 --- a/test/spec/modules/lockerdomeBidAdapter_spec.js +++ b/test/spec/modules/lockerdomeBidAdapter_spec.js @@ -74,7 +74,7 @@ describe('LockerDomeAdapter', function () { const bidderRequest = { refererInfo: { canonicalUrl: 'https://example.com/canonical', - referer: 'https://example.com' + topmostLocation: 'https://example.com' } }; const request = spec.buildRequests(bidRequests, bidderRequest); @@ -88,7 +88,7 @@ describe('LockerDomeAdapter', function () { expect(bids).to.have.lengthOf(2); expect(requestData.url).to.equal(encodeURIComponent(bidderRequest.refererInfo.canonicalUrl)); - expect(requestData.referrer).to.equal(encodeURIComponent(bidderRequest.refererInfo.referer)); + expect(requestData.referrer).to.equal(encodeURIComponent(bidderRequest.refererInfo.topmostLocation)); expect(bids[0].requestId).to.equal('2652ca954bce9'); expect(bids[0].adUnitCode).to.equal('ad-1'); diff --git a/test/spec/modules/loglyliftBidAdapter_spec.js b/test/spec/modules/loglyliftBidAdapter_spec.js index baa6ff05f39..59509fc0440 100644 --- a/test/spec/modules/loglyliftBidAdapter_spec.js +++ b/test/spec/modules/loglyliftBidAdapter_spec.js @@ -57,7 +57,8 @@ describe('loglyliftBidAdapter', function () { const bidderRequest = { refererInfo: { - referer: 'fakeReferer', + domain: 'domain', + page: 'fakeReferer', reachedTop: true, numIframes: 1, stack: [] @@ -152,7 +153,7 @@ describe('loglyliftBidAdapter', function () { expect(data.prebidJsVersion).to.equal('$prebid.version$'); expect(data.url).to.exist; expect(data.domain).to.exist; - expect(data.referer).to.equal(bidderRequest.refererInfo.referer); + expect(data.referer).to.equal(bidderRequest.refererInfo.page); expect(data.auctionStartTime).to.equal(bidderRequest.auctionStart); expect(data.currency).to.exist; expect(data.timeout).to.equal(bidderRequest.timeout);