Skip to content

Commit

Permalink
convert bidders: gmoss
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed May 20, 2022
1 parent 37c735a commit 46bf009
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
25 changes: 3 additions & 22 deletions modules/gmosspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@ function getUrlInfo(refererInfo) {
}

return {
url: getUrl(refererInfo),
canonicalLink: canonicalLink,
ref: getReferrer(),
// TODO: are these the right refererInfo values?
url: refererInfo.topmostLocation,
ref: refererInfo.ref || window.document.referrer,
};
}

Expand All @@ -169,24 +170,4 @@ function getMetaElements() {
}
}

function getUrl(refererInfo) {
if (refererInfo && refererInfo.referer) {
return refererInfo.referer;
}

try {
return getWindowTop.location.href;
} catch (e) {
return getWindowLocation.href;
}
}

function getReferrer() {
try {
return getWindowTop.document.referrer;
} catch (e) {
return document.referrer;
}
}

registerBidder(spec);
4 changes: 2 additions & 2 deletions test/spec/modules/gmosspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('GmosspAdapter', function () {
it('sends bid request to ENDPOINT via GET', function () {
const bidderRequest = {
refererInfo: {
referer: 'https://hoge.com'
topmostLocation: 'https://hoge.com'
}
};
const requests = spec.buildRequests(bidRequests, bidderRequest);
Expand All @@ -74,7 +74,7 @@ describe('GmosspAdapter', function () {
it('should use fallback if refererInfo.referer in bid request is empty and im_uid ,shared_id, idl_env cookie is empty', function () {
const bidderRequest = {
refererInfo: {
referer: ''
topmostLocation: ''
},
};
bidRequests[0].userId.imuid = '';
Expand Down

0 comments on commit 46bf009

Please sign in to comment.