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

Add Revcontent Adapter #4654

Merged
merged 21 commits into from
Jan 8, 2020
Merged

Add Revcontent Adapter #4654

merged 21 commits into from
Jan 8, 2020

Conversation

AzizSaleh
Copy link
Contributor

@AzizSaleh AzizSaleh commented Dec 19, 2019

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
  • Does this change affect user-facing APIs or examples documented on http://prebid.org?
  • Other

Description of change

Adding RevContent Bidder

  • test parameters for validating bids
{
  bidder: 'revcontent',
  params: {
      apiKey: '8a33sdfsdfdsfsdfssss544f8sdfsdfsdfd3b1c',  // Required
      userId: 69565,                                      // Required
      widgetId: 599995,                                   // Optional
      domain: 'test.com',                                 // Optional - Default referral hostname
  }
}

Test page: /integrationExamples/gpt/revcontent_example.html

contact email of the adapter’s maintainer: aziz@revcontent.com
[x] official adapter submission

For any changes that affect user-facing APIs or example code documented on http://prebid.org, please provide:

@robertrmartinez
Copy link
Collaborator

@AzizSaleh Now we're talkin!

Thanks, I will review and make some official comments sometime today / tomorrow.

We will be able to get this into the next prebid release!

@AzizSaleh
Copy link
Contributor Author

Thanks man! Much appreciated.

code: BIDDER_CODE,
supportedMediaTypes: ['banner', 'native', 'video'],
isBidRequestValid: function (bid) {
return (typeof bid.params.apiKey !== 'undefined' && typeof bid.params.userId !== 'undefined' && bid.hasOwnProperty('nativeParams'));
Copy link
Collaborator

Choose a reason for hiding this comment

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

so no matter what each bid needs nativeParams ?

Is revcontent only doing native ads?

Or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep only native at this time. I am going to update supportedMediaTypes to reflect.

}

if (typeof domain === 'undefined') {
domain = extractHostname(refererInfo);
Copy link
Collaborator

Choose a reason for hiding this comment

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

it may be possible that refererInfo is undefined at this point.

Which I believe could throw Cannot read property 'indexOf' of undefined inside the function extractHostname

May be a good idea to default this or skip this if refererInfo is not defined here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am going to update the actual function to return an empty string in such event.

domain = extractHostname(refererInfo);
}

var endpoint = '//' + host + '/rtb?apiKey=' + apiKey + '&userId=' + userId;
Copy link
Collaborator

Choose a reason for hiding this comment

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

For Prebid 3.0 we now require only HTTPS connections.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am going to update it so that it is secure all the time.

endpoint = endpoint + '&widgetId=' + widgetId;
}

let secure = location.protocol === 'https:';
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks to be a param passed to your ad exchange.

As noted above, we are requiring that all connections to be HTTPS now.

So not sure if you want to update this to always be true

let secure = location.protocol === 'https:';

const imp = validBidRequests.map((bid, id) => {
if (bid.hasOwnProperty('nativeParams')) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like (as mentioned above) nativeParams will always be on your bids since you are requiring it in validateBidRequests


return asset;
}
}).filter(Boolean);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice usage of filter(Boolean)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be fair, I copied that from the openRtb adapter implementation (since we are also using open rtb on the backend as well).


export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: ['banner', 'native', 'video'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like we are only supporting native as of now since nativeParams is required on every bid?

@robertrmartinez
Copy link
Collaborator

@AzizSaleh Couple of questions.

@robertrmartinez
Copy link
Collaborator

When testing the adapter I noticed the onBidWon imp trackers you are firing are returning a access-control-allow-origin which is not correct (Probably only because my test page utilzes ports) but wanted you to be aware?

image

Which then throws a:

Access to XMLHttpRequest at 'https://trends-s0.revcontent.com/imp.php' from origin 'http://www.rubitest.com:8000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'http://www.rubitest.com' that is not equal to the supplied origin.

Probably works fine for normal hostnames but wanted you to be aware.

var host = extractHostname(winUrl);

ajax(winUrl + '&viewed=1', null, {withCredentials: true});
ajax('https://' + host + '/imp.php', null, 'v=' + encodeURIComponent(encodeURIComponent(getQueryVariable('d', winUrl))) + '&i=' + encodeURIComponent(window.location.href), {method: 'POST', contentType: 'application/x-www-form-urlencoded'});
Copy link
Collaborator

Choose a reason for hiding this comment

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

While we do allow listening and firing imp trackers, can you explain the necessity to fire TWO imp trackers here?

We have allowed adapters to fire one in previous PR's, but wanted to know this use case and see if it can be updated to fire a single ajax call?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those are for different uses at the moment, we are working on reducing them into 1 call but to have accurate reporting we will need them both atm.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@AzizSaleh Ok, so I spoke with the Prebid Org team and while we are a little hesitant as we want to limit things like this, we will allow it.

So whenever your team gets around to reducing it to 1 please make the corresponding change here!

It may become a restricted thing in a future version of Prebid (Only allowing one track to fire per bidWon) but I will let you know ahead of time.

@AzizSaleh
Copy link
Contributor Author

When testing the adapter I noticed the onBidWon imp trackers you are firing are returning a access-control-allow-origin which is not correct (Probably only because my test page utilzes ports) but wanted you to be aware?

image

Which then throws a:

Access to XMLHttpRequest at 'https://trends-s0.revcontent.com/imp.php' from origin 'http://www.rubitest.com:8000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'http://www.rubitest.com' that is not equal to the supplied origin.

Probably works fine for normal hostnames but wanted you to be aware.

Yep that also happened to me while testing locally. Had to upload it live to see actual results:

https://feudfun.com/test21/revcontent_example.php

@AzizSaleh
Copy link
Contributor Author

@robertrmartinez I made a few updates, however, when doing a git pull (force of habit before committing) seems like pakage-lock.json. If everything looks fine, I can re-create the branch like I did last time to avoid that.

Copy link
Collaborator

@robertrmartinez robertrmartinez left a comment

Choose a reason for hiding this comment

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

Ok looks good!

@AzizSaleh
Copy link
Contributor Author

@robertrmartinez Greatly appreciate the +1. Quick question about the process, when should we expect a merge/deploy and what other steps do we need to do (more of timeline process question).

@robertrmartinez
Copy link
Collaborator

@AzizSaleh We will be releasing a new Prebid Version later today or tomorrow, so I will be sure to merge this into master before that!

So your adapter will officially be in Prebid Versions 3.2.0 and later!

@robertrmartinez
Copy link
Collaborator

@AzizSaleh Well I am really sorry but I dropped the ball!

I just now realized that you do not even have a test file.

We require that each adapter has a spec file which institutes 80% test coverage!

I went to check the test coverage for your adapter and realized it did not have a file at all!

Can you please add a file and get it up to 80%.

@AzizSaleh
Copy link
Contributor Author

@robertrmartinez Added the test file + removed a missed console.log on actual adapter.

Screenshot_2020-01-07 Code coverage report for modules revcontentBidAdapter js

@robertrmartinez robertrmartinez merged commit 8c42f02 into prebid:master Jan 8, 2020
redaguermas added a commit to redaguermas/Prebid.js that referenced this pull request Jan 8, 2020
…idVersion1.2.0

* 'master' of https://github.com/prebid/Prebid.js: (22 commits)
  fix lint errors in unit test file (prebid#4702)
  Add Revcontent Adapter (prebid#4654)
  Changed data structure in Platform One Analytic Adapter (prebid#4647)
  increment pre version
  Prebid 3.2.0 Release
  Add static API option to the consentManagementUsp module. (prebid#4685)
  replace all xhr stubs with global xhr stub to prevent all requests (prebid#4687)
  Add CCPA us_privacy support to spotxBidAdapter (prebid#4689)
  ucfunnel adapter support CCPA and remove utils.js in adapter (prebid#4541)
  freewheelSSPBidAdapter  (prebid#4645)
  Add CCPA support to Beachfront adapter (prebid#4673)
  add seedingAlliance Adapter (prebid#4614)
  Changed analytics data structure in YuktaMedia Analytic Adapter (prebid#4659)
  Add eplanning adapter for prebid 3.0 compliant and CCPA and GDPR support (prebid#4643)
  Bidder schain support (prebid#4551)
  Added CCPA support and GDPR compliance to Cedato adapter (prebid#4683)
  pass us privacy consent string to request (prebid#4581)
  Prebid 3 Admixer (prebid#4615)
  Pass uspConsent in bidRequest (prebid#4675)
  Advertly: New Bidder Adapter Submission (prebid#4496)
  ...
tadam75 pushed a commit to smartadserver/Prebid.js that referenced this pull request Jan 9, 2020
* Initial commit

* Update

* Update js

* Update file name

* Making it work (at least getting a response)

* Update native logic

* Updates to bidder

* Update prebidder

* Remove debugs

* Updates

* Add new templates

* Update templates

* Update email address

* Resolve conflict

* Resolve conflict

* Rebase from master

* Rebase from master

* Add Revcontent Adapter

* Force https, update supportedMediaTypes and add default return for extractHostname method

* Add test file + remove console.log statement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants