Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding appnexus debug via cookie/params #3152

Merged
merged 4 commits into from
Oct 9, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ export const spec = {
}
} else {
const debugBidRequest = find(bidRequests, hasDebug);
if (debugBidRequest && debugBidRequest['debug']) {
debugObj = debugBidRequest['debug'];
if (debugBidRequest && debugBidRequest.debug) {
debugObj = debugBidRequest.debug;
}
}

if (debugObj && debugObj['enabled']) {
if (debugObj && debugObj.enabled) {
Object.keys(debugObj)
.filter(param => includes(DEBUG_PARAMS, param))
.forEach(param => {
Expand Down Expand Up @@ -126,7 +126,7 @@ export const spec = {
payload.app = appIdObj;
}

if (debugObjParams && debugObjParams['enabled']) {
if (debugObjParams.enabled) {
payload.debug = debugObjParams;
utils.logInfo('AppNexus Debug Auction Settings:\n\n' + JSON.stringify(debugObjParams, null, 4));
}
Expand Down Expand Up @@ -188,8 +188,8 @@ 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
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
Expand All @@ -198,6 +198,7 @@ export const spec = {
.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");
aneuway2 marked this conversation as resolved.
Show resolved Hide resolved
utils.logMessage(debugText);
}

Expand Down