Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triplelift Adapter: Update referrer logic #9304

Merged
merged 10 commits into from
Nov 30, 2022
2 changes: 1 addition & 1 deletion modules/tripleliftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
13 changes: 3 additions & 10 deletions test/spec/modules/tripleliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down