Skip to content

Commit

Permalink
Revert "Adding appnexus debug via cookie/params" (prebid#3164)
Browse files Browse the repository at this point in the history
* Revert "Small bugfix and cleanup for Prebid Server OpenRTB code (prebid#3113)"

This reverts commit a1f07e9.

* Revert "Added support for user syncing pixel (prebid#3092)"

This reverts commit 8fdf61d.

* Revert "Add RSA validation to Criteo FastBid (prebid#3110)"

This reverts commit e72e2dc.

* Revert "Adding appnexus debug via cookie/params (prebid#3152)"

This reverts commit 4797ea2.
  • Loading branch information
mkendall07 authored and Isaac Dettman committed Nov 12, 2018
1 parent f613745 commit 0c49c73
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 84 deletions.
57 changes: 0 additions & 57 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const VIDEO_TARGETING = ['id', 'mimes', 'minduration', 'maxduration',
'startdelay', 'skippable', 'playback_method', 'frameworks'];
const USER_PARAMS = ['age', 'external_uid', 'segments', 'gender', 'dnt', 'language'];
const APP_DEVICE_PARAMS = ['geo', 'device_id']; // appid is collected separately
const DEBUG_PARAMS = ['enabled', 'dongle', 'member_id', 'debug_timeout'];
const NATIVE_MAPPING = {
body: 'description',
cta: 'ctatext',
Expand Down Expand Up @@ -78,32 +77,6 @@ export const spec = {
};
}

let debugObj = {};
let debugObjParams = {};
const debugCookieName = 'apn_prebid_debug';
const debugCookie = getCookie(debugCookieName) || null;

if (debugCookie) {
try {
debugObj = JSON.parse(debugCookie);
} catch (e) {
utils.logError('AppNexus Debug Auction Cookie Error:\n\n' + e);
}
} else {
const debugBidRequest = find(bidRequests, hasDebug);
if (debugBidRequest && debugBidRequest.debug) {
debugObj = debugBidRequest.debug;
}
}

if (debugObj && debugObj.enabled) {
Object.keys(debugObj)
.filter(param => includes(DEBUG_PARAMS, param))
.forEach(param => {
debugObjParams[param] = debugObj[param];
});
}

const memberIdBid = find(bidRequests, hasMemberId);
const member = memberIdBid ? parseInt(memberIdBid.params.member, 10) : 0;

Expand All @@ -126,11 +99,6 @@ export const spec = {
payload.app = appIdObj;
}

if (debugObjParams.enabled) {
payload.debug = debugObjParams;
utils.logInfo('AppNexus Debug Auction Settings:\n\n' + JSON.stringify(debugObjParams, null, 4));
}

if (bidderRequest && bidderRequest.gdprConsent) {
// note - objects for impbus use underscore instead of camelCase
payload.gdpr_consent = {
Expand Down Expand Up @@ -186,22 +154,6 @@ export const spec = {
}
});
}

if (serverResponse.debug && serverResponse.debug.debug_info) {
let debugHeader = 'AppNexus Debug Auction for Prebid\n\n';
let debugText = debugHeader + serverResponse.debug.debug_info;
debugText = debugText
.replace(/(<td>|<th>)/gm, '\t') // Tables
.replace(/(<\/td>|<\/th>)/gm, '\n') // Tables
.replace(/^<br>/gm, '') // Remove leading <br>
.replace(/(<br>\n|<br>)/gm, '\n') // <br>
.replace(/<h1>(.*)<\/h1>/gm, '\n\n===== $1 =====\n\n') // Header H1
.replace(/<h[2-6]>(.*)<\/h[2-6]>/gm, '\n\n*** $1 ***\n\n') // Headers
.replace(/(<([^>]+)>)/igm, ''); // Remove any other tags
utils.logMessage('AppNexus Debug Auction Glossary: https://wiki.appnexus.com/x/qwmHAg');
utils.logMessage(debugText);
}

return bids;
},

Expand Down Expand Up @@ -477,15 +429,6 @@ function hasAppId(bid) {
return !!bid.params.app
}

function hasDebug(bid) {
return !!bid.debug
}

function getCookie(name) {
let m = window.document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]*)\\s*(;|$)');
return m ? decodeURIComponent(m[2]) : null;
}

function getRtbBid(tag) {
return tag && tag.ads && tag.ads.length && find(tag.ads, ad => ad.rtb);
}
Expand Down
28 changes: 1 addition & 27 deletions test/spec/modules/appnexusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,33 +396,7 @@ describe('AppNexusAdapter', function () {
rd_stk: bidderRequest.refererInfo.stack.map((url) => encodeURIComponent(url)).join(',')
});
});

it('adds debug auction settings to payload', () => {
let debugRequest = Object.assign({},
bidRequests[0],
{
params: {
placementId: '10433394'
},
debug: {
enabled: true,
dongle: 'QWERTY',
member_id: 958,
debug_timeout: 1000
}
}
);
const request = spec.buildRequests([debugRequest]);
const payload = JSON.parse(request.data);
expect(payload.debug).to.exist;
expect(payload.debug).to.deep.equal({
enabled: true,
dongle: 'QWERTY',
member_id: 958,
debug_timeout: 1000
});
});
});
})

describe('interpretResponse', function () {
let response = {
Expand Down

0 comments on commit 0c49c73

Please sign in to comment.