Skip to content

Commit

Permalink
Triplelift Adapter: Update referrer logic (#9304)
Browse files Browse the repository at this point in the history
* prioritize topmostlocation

* adds test for topmostlocation / referrer

* cleanup

* delete param after test

* TL-32803: Update referrer logic

* TL-32803: Update referrer logic

Co-authored-by: Nick Llerandi <nllerandi@triplelift.com>
Co-authored-by: nllerandi3lift <75995508+nllerandi3lift@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 30, 2022
1 parent 5b13b54 commit 164e374
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
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

0 comments on commit 164e374

Please sign in to comment.