-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Appnexus adaptor - Added App parameters for hybrid apps. #2973
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @aneuway2
Can you remove the debug params from this PR? Also you have some test failures you need to resolve (run gulp test
to see them )
modules/appnexusBidAdapter.js
Outdated
let appDeviceObj; | ||
if (appDeviceObjBid) { | ||
appDeviceObj = {}; | ||
Object.keys(appDeviceObjBid.params.app) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will throw error if params
is undefined. Please add a check on line 66 to check that it exists.
modules/appnexusBidAdapter.js
Outdated
let appIdObj; | ||
if (appIdObjBid) { | ||
appIdObj = { | ||
appid: appIdObjBid.params.app.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will throw error if params and app are undefined. To access nested property you need to add check that it exist.
modules/appnexusBidAdapter.js
Outdated
debugObj['dongle'] = debugObjParams[param]; | ||
} | ||
if (param == 'ast_debug_member'){ | ||
debugObj['member_id'] = parseInt(debugObjParams[param]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide a second argument 10 which specifies the radix - a base 10 number. If you do not pass this and first argument starts with 0 than it would be considered as octal.
Same of other usage of parseInt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed from this PR, but will keep in mind for the next
modules/appnexusBidAdapter.js
Outdated
return false | ||
} | ||
|
||
function getURLparams() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can use utils.getWindowLocation()
and url.parse
instead of adding this function.
modules/appnexusBidAdapter.js
Outdated
@@ -381,6 +431,36 @@ function hasMemberId(bid) { | |||
return !!parseInt(bid.params.member, 10); | |||
} | |||
|
|||
function hasAppDeviceInfo(bid) { | |||
return !!bid.params.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add check for nested access
modules/appnexusBidAdapter.js
Outdated
} | ||
|
||
function hasAppId(bid) { | ||
if (!!bid.params.app) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add check for nested access
@mkendall07 - removed debug URL params from this PR (will follow up in future PR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appear to be a number of linting errors that need to be addressed (can see if you run gulp lint
).
Below is a copy of the errors for reference:
/Users/jsnellbaker/git/Prebid.js/modules/appnexusBidAdapter.js
13:50 error Multiple spaces found before '// appid is co...' no-multi-spaces
410:8 error Redundant double negation no-extra-boolean-cast
416:8 error Redundant double negation no-extra-boolean-cast
/Users/jsnellbaker/git/Prebid.js/test/spec/modules/appnexusBidAdapter_spec.js
337:19 error Strings must use singlequote quotes
343:23 error Strings must use singlequote quotes
344:23 error Strings must use singlequote quotes
345:26 error Strings must use singlequote quotes
346:27 error Strings must use singlequote quotes
347:30 error Strings must use singlequote quotes
357:16 error Strings must use singlequote quotes
361:15 error Strings must use singlequote quotes
362:15 error Strings must use singlequote quotes
363:18 error Strings must use singlequote quotes
364:19 error Strings must use singlequote quotes
365:22 error Strings must use singlequote quotes
…out the prebid 1.x versus the legacy ast/jpt adaptors. Added disclaimer on
Fixed linting errors @jsnellbaker |
@@ -59,6 +60,23 @@ export const spec = { | |||
.forEach(param => userObj[param] = userObjBid.params.user[param]); | |||
} | |||
|
|||
const appDeviceObjBid = find(bidRequests, hasAppDeviceInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aneuway2 Just to confirm a use-case - do you foresee the chance that multiple adUnits for appnexus
would ever have differing values for this device
/geo
fields?
This find
grabs the first matching result and uses that for the value. If you had multiple adUnits with differing sets of values, only the first set of those values would be used - potentially skewing the request that gets generated.
I'm not sure this would happen, but I wanted to clarify just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsnellbaker device and geo are both related to the current user, so these should remain the same between adUnits
…932) * Adding addiional info on onEvent handlers, and PBS timeout * Appnexus adaptor parameters. Added for prebid/Prebid.js#2973, sorted out the prebid 1.x versus the legacy ast/jpt adaptors. Added disclaimer on * Updating sample native adserver creative to add in click tracking * made minor changes from review. Also added video params tabel from AST to 1.x version and info about keywords to the upgrade section * Fix to typos
Type of change
Description of change
Added App parameters for hybrid apps. This allows developers running Prebid in a webview with prebid to pass the app related parameters. (Note that this is not the same as Prebid Mobile)