From 33e8fdf582ce41e088dd5c09af856c130c51395c Mon Sep 17 00:00:00 2001 From: Nick Llerandi Date: Mon, 31 Oct 2022 14:22:57 -0400 Subject: [PATCH 1/6] prioritize topmostlocation --- modules/tripleliftBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 7f6ec90c7b9..3fdabcfa6d2 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -29,7 +29,7 @@ export const tripleliftAdapterSpec = { tlCall = tryAppendQueryString(tlCall, 'v', '$prebid.version$'); if (bidderRequest && bidderRequest.refererInfo) { - let referrer = bidderRequest.refererInfo.page; + let referrer = bidderRequest?.refererInfo?.topmostLocation || bidderRequest?.refererInfo?.page; tlCall = tryAppendQueryString(tlCall, 'referrer', referrer); } From 667fb2e189ff019489739922ee143359c98af6f3 Mon Sep 17 00:00:00 2001 From: Nick Llerandi Date: Mon, 31 Oct 2022 15:05:42 -0400 Subject: [PATCH 2/6] adds test for topmostlocation / referrer --- test/spec/modules/tripleliftBidAdapter_spec.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index e485ae3998f..dad2a422537 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -573,7 +573,7 @@ describe('triplelift adapter', function () { } ], refererInfo: { - page: 'https://examplereferer.com' + page: 'https://examplereferer.com', }, gdprConsent: { consentString: GDPR_CONSENT_STR, @@ -979,6 +979,18 @@ describe('triplelift adapter', function () { expect(url).to.match(new RegExp('(?:' + prebid.version + ')')) expect(url).to.match(/(?:referrer)/); }); + it('should prioritize topmostLocation for referrer', function () { + bidderRequest.refererInfo.topmostLocation = 'https://topmostlocation.com?foo=bar' + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); + const url = request.url; + expect(url).to.match(/(\?|&)referrer=https%3A%2F%2Ftopmostlocation.com%3Ffoo%3Dbar/); + }); + it('should fall back to page for referrer if topmostLocation is unavailable', function () { + bidderRequest.refererInfo.topmostLocation = null + const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); + const url = request.url; + expect(url).to.match(/(\?|&)referrer=https%3A%2F%2Fexamplereferer.com/); + }); it('should return us_privacy param when CCPA info is available', function() { bidderRequest.uspConsent = '1YYY'; const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); From 6e5c0b0b9d689e34405d40b47aa365b54a31a236 Mon Sep 17 00:00:00 2001 From: Nick Llerandi Date: Mon, 31 Oct 2022 15:10:00 -0400 Subject: [PATCH 3/6] cleanup --- test/spec/modules/tripleliftBidAdapter_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index dad2a422537..7ea254952ae 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -573,7 +573,7 @@ describe('triplelift adapter', function () { } ], refererInfo: { - page: 'https://examplereferer.com', + page: 'https://examplereferer.com' }, gdprConsent: { consentString: GDPR_CONSENT_STR, From 378861148e15ba43c47aba77c0f894a7e999fa3c Mon Sep 17 00:00:00 2001 From: Nick Llerandi Date: Mon, 31 Oct 2022 15:45:19 -0400 Subject: [PATCH 4/6] delete param after test --- test/spec/modules/tripleliftBidAdapter_spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index 7ea254952ae..4cab8be7e09 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -984,12 +984,14 @@ describe('triplelift adapter', function () { const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); const url = request.url; expect(url).to.match(/(\?|&)referrer=https%3A%2F%2Ftopmostlocation.com%3Ffoo%3Dbar/); + delete bidderRequest.refererInfo.topmostLocation }); it('should fall back to page for referrer if topmostLocation is unavailable', function () { bidderRequest.refererInfo.topmostLocation = null const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); const url = request.url; expect(url).to.match(/(\?|&)referrer=https%3A%2F%2Fexamplereferer.com/); + delete bidderRequest.refererInfo.topmostLocation }); it('should return us_privacy param when CCPA info is available', function() { bidderRequest.uspConsent = '1YYY'; From b92cf2617b7d3449ce78efbf3ed40406a3d3c42b Mon Sep 17 00:00:00 2001 From: Patrick Loughrey Date: Tue, 29 Nov 2022 16:25:51 -0500 Subject: [PATCH 5/6] TL-32803: Update referrer logic --- modules/tripleliftBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tripleliftBidAdapter.js b/modules/tripleliftBidAdapter.js index 3fdabcfa6d2..7f6ec90c7b9 100644 --- a/modules/tripleliftBidAdapter.js +++ b/modules/tripleliftBidAdapter.js @@ -29,7 +29,7 @@ export const tripleliftAdapterSpec = { tlCall = tryAppendQueryString(tlCall, 'v', '$prebid.version$'); if (bidderRequest && bidderRequest.refererInfo) { - let referrer = bidderRequest?.refererInfo?.topmostLocation || bidderRequest?.refererInfo?.page; + let referrer = bidderRequest.refererInfo.page; tlCall = tryAppendQueryString(tlCall, 'referrer', referrer); } From f2685be40c102668afdc4df707c8a144278d3185 Mon Sep 17 00:00:00 2001 From: Patrick Loughrey Date: Wed, 30 Nov 2022 11:03:37 -0500 Subject: [PATCH 6/6] TL-32803: Update referrer logic --- test/spec/modules/tripleliftBidAdapter_spec.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/test/spec/modules/tripleliftBidAdapter_spec.js b/test/spec/modules/tripleliftBidAdapter_spec.js index 4cab8be7e09..5cfa64184f9 100644 --- a/test/spec/modules/tripleliftBidAdapter_spec.js +++ b/test/spec/modules/tripleliftBidAdapter_spec.js @@ -979,19 +979,12 @@ describe('triplelift adapter', function () { expect(url).to.match(new RegExp('(?:' + prebid.version + ')')) expect(url).to.match(/(?:referrer)/); }); - it('should prioritize topmostLocation for referrer', function () { - bidderRequest.refererInfo.topmostLocation = 'https://topmostlocation.com?foo=bar' + it('should use refererInfo.page for referrer', function () { + bidderRequest.refererInfo.page = 'https://topmostlocation.com?foo=bar' const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); const url = request.url; expect(url).to.match(/(\?|&)referrer=https%3A%2F%2Ftopmostlocation.com%3Ffoo%3Dbar/); - delete bidderRequest.refererInfo.topmostLocation - }); - it('should fall back to page for referrer if topmostLocation is unavailable', function () { - bidderRequest.refererInfo.topmostLocation = null - const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest); - const url = request.url; - expect(url).to.match(/(\?|&)referrer=https%3A%2F%2Fexamplereferer.com/); - delete bidderRequest.refererInfo.topmostLocation + delete bidderRequest.refererInfo.page }); it('should return us_privacy param when CCPA info is available', function() { bidderRequest.uspConsent = '1YYY';