Skip to content

Commit

Permalink
convert bidders: grid
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed May 20, 2022
1 parent 46bf009 commit 1fcf289
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion modules/gnetBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export const spec = {
*/
buildRequests: function (validBidRequests, bidderRequest) {
const bidRequests = [];
const referer = bidderRequest.refererInfo.referer;
// TODO: is 'page' the right value?
const referer = bidderRequest.refererInfo.page;

_each(validBidRequests, (request) => {
const data = {};
Expand Down
3 changes: 2 additions & 1 deletion modules/goldbachBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ export const spec = {

if (bidderRequest && bidderRequest.refererInfo) {
let refererinfo = {
rd_ref: encodeURIComponent(bidderRequest.refererInfo.referer),
// TODO: this collects everything it finds, except for topmostLocation
rd_ref: encodeURIComponent(bidderRequest.refererInfo.topmostLocation),
rd_top: bidderRequest.refererInfo.reachedTop,
rd_ifs: bidderRequest.refererInfo.numIframes,
rd_stk: bidderRequest.refererInfo.stack.map((url) => encodeURIComponent(url)).join(',')
Expand Down
3 changes: 2 additions & 1 deletion modules/gothamadsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ export const spec = {

let winTop = window;
let location;
// TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
try {
location = new URL(bidderRequest.refererInfo.referer)
location = new URL(bidderRequest.refererInfo.page)
winTop = window.top;
} catch (e) {
location = winTop.location;
Expand Down
3 changes: 2 additions & 1 deletion modules/gridBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export const spec = {
let userExt = null;
let {bidderRequestId, auctionId, gdprConsent, uspConsent, timeout, refererInfo} = bidderRequest || {};

const referer = refererInfo ? encodeURIComponent(refererInfo.referer) : '';
// TODO: is 'page' the right value here?
const referer = refererInfo ? encodeURIComponent(refererInfo.page) : '';
const imp = [];
const bidsMap = {};

Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/gnetBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('gnetAdapter', function () {

const bidderRequest = {
refererInfo: {
referer: 'https://gnetrtb.com'
page: 'https://gnetrtb.com'
}
};

Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/goldbachBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ describe('GoldbachXandrAdapter', function () {
const bidRequest = Object.assign({}, bidRequests[0])
const bidderRequest = {
refererInfo: {
referer: 'https://example.com/page.html',
topmostLocation: 'https://example.com/page.html',
reachedTop: true,
numIframes: 2,
stack: [
Expand Down
8 changes: 4 additions & 4 deletions test/spec/modules/gridBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ describe('TheMediaGrid Adapter', function () {
return JSON.parse(data);
}
const bidderRequest = {
refererInfo: {referer: 'https://example.com'},
refererInfo: {page: 'https://example.com'},
bidderRequestId: '22edbae2733bf6',
auctionId: '9e2dfbfe-00c7-4f5e-9850-4044df3229c7',
timeout: 3000
};
const referrer = encodeURIComponent(bidderRequest.refererInfo.referer);
const referrer = encodeURIComponent(bidderRequest.refererInfo.page);
let bidRequests = [
{
'bidder': 'grid',
Expand Down Expand Up @@ -736,12 +736,12 @@ describe('TheMediaGrid Adapter', function () {
'auctionId': 654645,
};
const bidderRequestWithNumId = {
refererInfo: {referer: 'https://example.com'},
refererInfo: {page: 'https://example.com'},
bidderRequestId: 345345345,
auctionId: 654645,
timeout: 3000
};
const parsedReferrer = encodeURIComponent(bidderRequestWithNumId.refererInfo.referer);
const parsedReferrer = encodeURIComponent(bidderRequestWithNumId.refererInfo.page);
const request = spec.buildRequests([bidRequestWithNumId], bidderRequestWithNumId);
expect(request.data).to.be.an('string');
const payload = parseRequest(request.data);
Expand Down

0 comments on commit 1fcf289

Please sign in to comment.