Skip to content

Commit

Permalink
convert bidders: loglyft
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed May 20, 2022
1 parent f6c3be0 commit ab4e778
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion modules/lkqdBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 3 additions & 4 deletions modules/lockerdomeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions modules/loglyliftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions test/spec/modules/lockerdomeBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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');
Expand Down
5 changes: 3 additions & 2 deletions test/spec/modules/loglyliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ describe('loglyliftBidAdapter', function () {

const bidderRequest = {
refererInfo: {
referer: 'fakeReferer',
domain: 'domain',
page: 'fakeReferer',
reachedTop: true,
numIframes: 1,
stack: []
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ab4e778

Please sign in to comment.