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

Trustx adapter #1488

Merged
merged 7 commits into from
Sep 19, 2017
Merged

Trustx adapter #1488

merged 7 commits into from
Sep 19, 2017

Conversation

PWyrembak
Copy link
Contributor

Type of change

  • Bugfix
  • Feature
  • New bidder adapter
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other

Description of change

Adding an Trustx adapter.
Added module, test spec and integration example for Trustx Bid Adapter in hello_world.html.

  • test parameters for validating bids
{
    bidder: 'trustx',
    params: {
        uid: 42
    }
},
{
    bidder: 'trustx',
    params: {
        uid: 43
    }
},
{
    bidder: 'trustx',
    params: {
        uid: 44
    }
},
{
    bidder: 'trustx',
    params: {
        uid: 45
    }
}

You can setup globalPrebidTrustxPriceType to use net price type:

window.globalPrebidTrustxPriceType = 'net'

Be sure to test the integration with your adserver using the Hello World sample page.

@PWyrembak
Copy link
Contributor Author

Hello,
Could you please comment on the reasons of trustx-adaptor pull request being rejected?

@mkendall07
Copy link
Member

this hasn't been reviewed yet, but the build is failing. Run gulp test locally to see and fix the error.

@PWyrembak
Copy link
Contributor Author

We run gulp test and it looks like the build failing not really due to adaptor code malfunctioning:

HeadlessChrome 0.0.0 (Linux 0.0.0) "before each" hook FAILED
Error: Uncaught SyntaxError: Unexpected token < (http://localhost:9876/context.html:1)
HeadlessChrome 0.0.0 (Linux 0.0.0): Executed 772 of 1164 (1 FAILED) (skipped 1) (0 secs / 2.66 secs)
HeadlessChrome 0.0.0 (Linux 0.0.0) "before each" hook FAILED
Error: Uncaught SyntaxError: Unexpected token < (http://localhost:9876/context.html:1)
e 0.0.0 (Linux 0.0.0): Executed 772 of 1164 (1 FAILED) (skipped 1) (25.213 secs / 2.66 secs)
[13:37:40] 'test-coverage' errored after 2.08 min
[13:37:40] Error: Karma tests failed with exit code 1
at /home/travis/build/prebid/Prebid.js/gulpfile.js:94:12
at removeAllListeners (/home/travis/build/prebid/Prebid.js/node_modules/karma/lib/server.js:380:7)
at Server. (/home/travis/build/prebid/Prebid.js/node_modules/karma/lib/server.js:391:9)
at Server.g (events.js:291:16)
at emitNone (events.js:91:20)
at Server.emit (events.js:185:7)
at emitCloseNT (net.js:1544:8)
at _combinedTickCallback (internal/process/next_tick.js:71:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

Could you please check?

Copy link
Collaborator

@matthewlane matthewlane left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. The Unexpected token < error can be ignored, that's an unrelated failure and after rerunning your tests they are passing. I was also able to validate bid responses. A few changes requested below

@@ -22,11 +22,29 @@

// Replace this object to test a new Adapter!
bids: [{
bidder: 'appnexus',
bidder: 'trustx',
Copy link
Collaborator

Choose a reason for hiding this comment

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

This page is just for testing, changes to this file aren't required in PRs so the changes here can be dropped

}
}

function tryToSendStat(startTime, timeout, auids, isTimeouted, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't permit bid adapters to collect information about the auction mechanics, this function should be dropped. If you'd like to collect this info please create an analytics adapter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes sense. I would like to note that this function doesn't collect any information on the 'auction mechanics' itself- it sends TrustX header bidder information on the amount of header bids which have timeouted. Do you still think we should remove this function from the adapter code? Would an analytics adapter provide such information to the header bidder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes sense. I would like to note that this function doesn't collect any information on the 'auction mechanics' itself- it sends TrustX header bidder information on the amount of header bids which have timeouted. Do you still think we should remove this function from the adapter code? Would an analytics adapter provide such information to the header bidder?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for clarifying. Yes, the function should remain removed as adapters should only make the minimum amount of network calls necessary for the sake of performance. Analytic adapters do have access to the BID_TIMEOUT event

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the details. As I can see you have removed the 'trytosend' stat function. Do I understand correct that you don't need us to make any changes to the TrustX adapter code for now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Correct, no further changes requested from me. Next a second reviewer will be assigned per our PR process and they may have additional feedback for you before merging

var active = true;
var handler = function() {
worker.called = true;
$$PREBID_GLOBAL$$.offEvent('bidTimeout', handler);
Copy link
Collaborator

Choose a reason for hiding this comment

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

$$PREBID_GLOBAL$$.offEvent and $$PREBID_GLOBAL$$.onEvent are meant for publisher use and shouldn't be needed within bidder adapters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you please let us know what we should replace $$PREBID_GLOBAL$$.offEvent and $$PREBID_GLOBAL$$.onEvent with?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you please let us know what we should replace $$PREBID_GLOBAL$$.offEvent and $$PREBID_GLOBAL$$.onEvent with?

@@ -0,0 +1,167 @@
var utils = require('src/utils.js');
Copy link
Member

Choose a reason for hiding this comment

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

prefer const or let

function _forEachPlacement(error, bid, placementCode) {
var bidObject;
if (error) {
bidObject = bidfactory.createBid(2);
Copy link
Member

@mkendall07 mkendall07 Sep 13, 2017

Choose a reason for hiding this comment

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

use constant value here (STATUS.GOOD, STATUS. NO_BID)

if (error) {
bidObject = bidfactory.createBid(2);
} else {
bidObject = bidfactory.createBid(1);
Copy link
Member

Choose a reason for hiding this comment

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

pass through the bid request object as a 2nd argument to createBid. See example here: https://github.com/prebid/Prebid.js/blob/master/modules/appnexusAstBidAdapter.js#L206

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the update. do we need to apply these changes to the code by ourselves?

Copy link
Member

Choose a reason for hiding this comment

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

Yes please make the update so we can merge your adapter. Thanks.

@PWyrembak
Copy link
Contributor Author

Hello,
Could you please review the fixes?
Thanks

@mkendall07 mkendall07 merged commit ea97915 into prebid:master Sep 19, 2017
@mkendall07
Copy link
Member

This is merged into master. Please submit a PR to the docs repo to add a file for your adapter to the bidders directory so your adapter's params will appear on the bidders page. Thank you for contributing

jbAdyoulike pushed a commit to jbAdyoulike/Prebid.js that referenced this pull request Sep 21, 2017
* Add trustx adapter and tests for it

* update integration example

* Update trustx adapter

* Post-review fixes of Trustx adapter
outoftime pushed a commit to Genius/Prebid.js that referenced this pull request Sep 21, 2017
* tag '0.29.0' of https://github.com/prebid/Prebid.js: (29 commits)
  Prebid 0.29.0 Release
  Fix for not syncing bidders.  (prebid#1598)
  fix amp example pages (prebid#1597)
  closes prebid#1298 (prebid#1583)
  Fixed the broken tests. (prebid#1602)
  Rubicon Bidder Factory (prebid#1587)
  Trustx adapter (prebid#1488)
  Add nurl to markup (prebid#1601)
  Pass bidRequest to createBid (prebid#1600)
  Add Kumma adapter (prebid#1512)
  Serverbid alias (prebid#1560)
  Add user sync to process for approving adapter PRs (prebid#1457)
  fix travis build (prebid#1595)
  Rubicon project improvement/user sync (prebid#1549)
  Adding Orbitsoft adapter (prebid#1378)
  Fix renderer test for new validation rule (prebid#1592)
  Allow SET_TARGETING to be used in AnalyticsAdapter (prebid#1577)
  Add support for video stream context (prebid#1483)
  Invalidate bid if matching bid request not found (prebid#1575)
  allow adapters to set default adserverTargeting for specific bid (prebid#1568)
  ...
@PWyrembak
Copy link
Contributor Author

We've submitted the PR to the docs repo: prebid/prebid.github.io#378.
Pending approval.

@PWyrembak
Copy link
Contributor Author

Hey team,
we would like to make a simple adjustment to our TrustX adapter currently available in the repo. Can we expect you reviewing it and merging soon?

dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
* Add trustx adapter and tests for it

* update integration example

* Update trustx adapter

* Post-review fixes of Trustx adapter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants