Skip to content

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

Merged
merged 5 commits into from
Aug 21, 2018

Conversation

aneuway2
Copy link
Contributor

@aneuway2 aneuway2 commented Aug 13, 2018

Type of change

  • Feature

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)

  • test parameters for validating bids
{
  bidder: '<bidder name>',
  placementId: '10433394',
  app: {
    id: "B1O2W3M4AN.com.prebid.webview",
    geo: {
      lat: 40.0964439,
      lng: -75.3009142
    },
    device_id: {
      idfa: "4D12078D-3246-4DA4-AD5E-7610481E7AE", // Apple advertising identifier
      aaid: "38400000-8cf0-11bd-b23e-10b96e40000d", // Android advertising identifier
      md5udid: "5756ae9022b2ea1e47d84fead75220c8", // MD5 hash of the ANDROID_ID
      sha1udid: "4DFAA92388699AC6539885AEF1719293879985BF", // SHA1 hash of the ANDROID_ID
      windowsadid: "750c6be243f1c4b5c9912b95a5742fc5" // Windows advertising identifier
    }
  }
}

Copy link
Member

@mkendall07 mkendall07 left a 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 )

let appDeviceObj;
if (appDeviceObjBid) {
appDeviceObj = {};
Object.keys(appDeviceObjBid.params.app)
Copy link
Collaborator

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.

let appIdObj;
if (appIdObjBid) {
appIdObj = {
appid: appIdObjBid.params.app.id
Copy link
Collaborator

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.

debugObj['dongle'] = debugObjParams[param];
}
if (param == 'ast_debug_member'){
debugObj['member_id'] = parseInt(debugObjParams[param]);
Copy link
Collaborator

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

Copy link
Contributor Author

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

return false
}

function getURLparams() {
Copy link
Collaborator

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.

@@ -381,6 +431,36 @@ function hasMemberId(bid) {
return !!parseInt(bid.params.member, 10);
}

function hasAppDeviceInfo(bid) {
return !!bid.params.app
Copy link
Collaborator

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

}

function hasAppId(bid) {
if (!!bid.params.app) {
Copy link
Collaborator

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

@aneuway2
Copy link
Contributor Author

@mkendall07 - removed debug URL params from this PR (will follow up in future PR)
@jaiminpanchal27 - added changes per your review

@aneuway2 aneuway2 changed the title Added App parameters for hybrid apps. Also added AST debug URL params Appnexus adaptor - Added App parameters for hybrid apps. Aug 16, 2018
Copy link
Collaborator

@jsnellbaker jsnellbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aneuway2

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

aneuway2 added a commit to aneuway2/prebid.github.io that referenced this pull request Aug 16, 2018
…out the prebid 1.x versus the legacy ast/jpt adaptors. Added disclaimer on
@aneuway2
Copy link
Contributor Author

Fixed linting errors @jsnellbaker

@@ -59,6 +60,23 @@ export const spec = {
.forEach(param => userObj[param] = userObjBid.params.user[param]);
}

const appDeviceObjBid = find(bidRequests, hasAppDeviceInfo);
Copy link
Collaborator

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.

Copy link
Contributor Author

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

@mkendall07 mkendall07 merged commit 65df3bb into prebid:master Aug 21, 2018
jeanstemp pushed a commit to prebid/prebid.github.io that referenced this pull request Aug 22, 2018
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants