Skip to content

Commit

Permalink
convert bidders: appnexus
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed May 19, 2022
1 parent 2d57f41 commit 0f5d97b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 5 additions & 1 deletion modules/appierBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ export const spec = {
const bidderApiUrl = `//${server}${BIDDER_API_ENDPOINT}`
const payload = {
'bids': bidRequests,
'refererInfo': bidderRequest.refererInfo,
// TODO: please do not pass internal data structures over to the network
'refererInfo': {
...bidderRequest.refererInfo,
referer: bidderRequest.refererInfo.topmostLocation,
},
'version': ADAPTER_VERSION
};
return [{
Expand Down
5 changes: 3 additions & 2 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,13 @@ export const spec = {

if (bidderRequest && bidderRequest.refererInfo) {
let refererinfo = {
rd_ref: encodeURIComponent(bidderRequest.refererInfo.referer),
// TODO: are these the correct referer values?
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(',')
}
let pubPageUrl = config.getConfig('pageUrl');
let pubPageUrl = bidderRequest.refererInfo.canonicalUrl;
if (isStr(pubPageUrl) && pubPageUrl !== '') {
refererinfo.rd_can = pubPageUrl;
}
Expand Down
11 changes: 3 additions & 8 deletions test/spec/modules/appnexusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ describe('AppNexusAdapter', 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 All @@ -895,14 +895,11 @@ describe('AppNexusAdapter', function () {

it('if defined, should include publisher pageUrl to normal referer info in payload', function () {
const bidRequest = Object.assign({}, bidRequests[0]);
sinon
.stub(config, 'getConfig')
.withArgs('pageUrl')
.returns('https://mypub.override.com/test/page.html');

const bidderRequest = {
refererInfo: {
referer: 'https://example.com/page.html',
canonicalUrl: 'https://mypub.override.com/test/page.html',
topmostLocation: 'https://example.com/page.html',
reachedTop: true,
numIframes: 2,
stack: [
Expand All @@ -923,8 +920,6 @@ describe('AppNexusAdapter', function () {
rd_stk: bidderRequest.refererInfo.stack.map((url) => encodeURIComponent(url)).join(','),
rd_can: 'https://mypub.override.com/test/page.html'
});

config.getConfig.restore();
});

it('should populate schain if available', function () {
Expand Down

0 comments on commit 0f5d97b

Please sign in to comment.