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

TL-32522: prioritize topmostLocation as referrer #62

Merged
merged 3 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.page;
let referrer = bidderRequest?.refererInfo?.topmostLocation || bidderRequest?.refererInfo?.page;
tlCall = tryAppendQueryString(tlCall, 'referrer', referrer);
}

Expand Down
12 changes: 12 additions & 0 deletions test/spec/modules/tripleliftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrickloughrey I was just thinking that when we revert this back to simply using bidderRequest.refererInfo.page we'll want to delete these tests. Just an FYI that you'll see these fail otherwise.

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);
Expand Down